19 lines
460 B
JavaScript
19 lines
460 B
JavaScript
|
|
(function(old) {
|
||
|
|
$.fn.attr = function() {
|
||
|
|
if(arguments.length === 0) {
|
||
|
|
if(this.length === 0) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
var obj = {};
|
||
|
|
$.each(this[0].attributes, function() {
|
||
|
|
if(this.specified) {
|
||
|
|
obj[this.name] = this.value;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
return obj;
|
||
|
|
}
|
||
|
|
|
||
|
|
return old.apply(this, arguments);
|
||
|
|
};
|
||
|
|
})($.fn.attr);
|