Krinkle has uploaded a new change for review.
https://gerrit.wikimedia.org/r/176872
Change subject: Icon: Remove confusing '0' argument to '.children()'
......................................................................
Icon: Remove confusing '0' argument to '.children()'
.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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/72/176872/1
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: newchange
Gerrit-Change-Id: Id013465f0093e06795c978441099cc7fc2056fa9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits