2 * @class jQuery.plugin.getAttrs
6 * Get the attributes of an element directy as a plain object.
8 * If there are more elements in the collection, like most jQuery get/read methods,
9 * this method will use the first element in the collection.
11 * In IE6, the `attributes` map of a node includes *all* allowed attributes
12 * for an element (including those not set). Those will have values like
13 * `undefined`, `null`, `0`, `false`, `""` or `"inherit"`.
15 * However there may be attributes genuinely set to one of those values, and there
16 * is no way to distinguish between attributes set to that and those not set and
17 * it being the default. If you need them, set `all` to `true`. They are filtered out
20 * @param {boolean} [all=false]
23 jQuery.fn.getAttrs = function ( all ) {
24 var map = this[0].attributes,
29 for ( i = 0; i < len; i++ ) {
31 if ( all || ( v && v !== 'inherit' ) ) {
32 attrs[ map[i].nodeName ] = v;
41 * @mixins jQuery.plugin.getAttrs