Add way of including all stderr output when executing command
[mediawiki.git] / resources / jquery / jquery.getAttrs.js
blob25b806b6e65776f575a764a81aadded9a2146e2c
1 /**
2  * Utility to get all attributes of an element directy as an object.
3  *
4  * @author Timo Tijhof, 2011
5  */
6 jQuery.fn.getAttrs = function ( all ) {
7         var map = this[0].attributes,
8                 attrs = {},
9                 len = map.length,
10                 i, v;
12         for ( i = 0; i < len; i++ ) {
13                 // IE6 includes *all* allowed attributes for thew element (including those
14                 // not set). Those have values like undefined, null, 0, false, "" or "inherit".
15                 // However there may be genuine attributes set to that. If you need them,
16                 // set all to true. They are excluded by default.
17                 v = map[i].nodeValue;
18                 if ( all || ( v && v !== 'inherit' ) ) {
19                         attrs[ map[i].nodeName ] = v;
20                 }
21         }
23         return attrs;