jenkins-bot has submitted this change and it was merged. Change subject: jquery.getAttrs: Add jsduck documentation ......................................................................
jquery.getAttrs: Add jsduck documentation Change-Id: Ic7c10bb4fdeb7d76c0b6b09dab6957536601a20a --- M maintenance/jsduck/config.json M resources/src/jquery/jquery.getAttrs.js 2 files changed, 25 insertions(+), 6 deletions(-) Approvals: Bartosz Dziewoński: Looks good to me, approved jenkins-bot: Verified diff --git a/maintenance/jsduck/config.json b/maintenance/jsduck/config.json index 5d2e304..d203baf 100644 --- a/maintenance/jsduck/config.json +++ b/maintenance/jsduck/config.json @@ -22,6 +22,7 @@ "../../resources/src/jquery/jquery.byteLimit.js", "../../resources/src/jquery/jquery.client.js", "../../resources/src/jquery/jquery.colorUtil.js", + "../../resources/src/jquery/jquery.getAttrs.js", "../../resources/src/jquery/jquery.localize.js", "../../resources/src/jquery/jquery.makeCollapsible.js", "../../resources/src/jquery/jquery.spinner.js", diff --git a/resources/src/jquery/jquery.getAttrs.js b/resources/src/jquery/jquery.getAttrs.js index 25b806b..c44831c 100644 --- a/resources/src/jquery/jquery.getAttrs.js +++ b/resources/src/jquery/jquery.getAttrs.js @@ -1,7 +1,24 @@ /** - * Utility to get all attributes of an element directy as an object. + * @class jQuery.plugin.getAttrs + */ + +/** + * Get the attributes of an element directy as a plain object. * - * @author Timo Tijhof, 2011 + * If there are more elements in the collection, like most jQuery get/read methods, + * this method will use the first element in the collection. + * + * In IE6, the `attributes` map of a node includes *all* allowed attributes + * for an element (including those not set). Those will have values like + * `undefined`, `null`, `0`, `false`, `""` or `"inherit"`. + * + * However there may be attributes genuinely set to one of those values, and there + * is no way to distinguish between attributes set to that and those not set and + * it being the default. If you need them, set `all` to `true`. They are filtered out + * by default. + * + * @param {boolean} [all=false] + * @return {Object} */ jQuery.fn.getAttrs = function ( all ) { var map = this[0].attributes, @@ -10,10 +27,6 @@ i, v; for ( i = 0; i < len; i++ ) { - // IE6 includes *all* allowed attributes for thew element (including those - // not set). Those have values like undefined, null, 0, false, "" or "inherit". - // However there may be genuine attributes set to that. If you need them, - // set all to true. They are excluded by default. v = map[i].nodeValue; if ( all || ( v && v !== 'inherit' ) ) { attrs[ map[i].nodeName ] = v; @@ -22,3 +35,8 @@ return attrs; }; + +/** + * @class jQuery + * @mixins jQuery.plugin.getAttrs + */ -- To view, visit https://gerrit.wikimedia.org/r/129959 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic7c10bb4fdeb7d76c0b6b09dab6957536601a20a Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org> Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits