jenkins-bot has submitted this change and it was merged.

Change subject: Icon: Remove confusing '0' argument to '.children()'
......................................................................


Icon: Remove confusing '0' argument to '.children()'

Follows-up 5c82ce1a9a.

.children() returns the child elements of the node(s) and
takes an optional CSS selector to filter these children.

Passing it a number has unexpected results. Normally this would
be casted to a string and used as selector and return an empty
jQuery collection and break the Icon class. However, as jQuery
only consideres non-falsey values, it instead returns all children.
(As if no argument was passed.)

It still worked because, in fact, no reduction to the first child
is needed at all.
* This Icon template only has one element.
* Getter methods like .attr(), .val() etc. can return only one
  value, that of the first element. This is a documented and
  established jQuery convention.

Change-Id: Id013465f0093e06795c978441099cc7fc2056fa9
---
M javascripts/Icon.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Bmansurov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/javascripts/Icon.js b/javascripts/Icon.js
index e239526..4d4a6d5 100644
--- a/javascripts/Icon.js
+++ b/javascripts/Icon.js
@@ -24,7 +24,7 @@
                 * @return {string}
                 */
                getClassName: function () {
-                       return this.$el.children( 0 ).attr( 'class' );
+                       return this.$el.children().attr( 'class' );
                },
                /**
                 * Return the class that relates to the icon glyph

-- 
To view, visit https://gerrit.wikimedia.org/r/176872
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id013465f0093e06795c978441099cc7fc2056fa9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to