Commit 607210e0 authored by timmywil's avatar timmywil

Speed up hasAttr a little

parent 5eecb13f
...@@ -334,18 +334,20 @@ jQuery.extend({ ...@@ -334,18 +334,20 @@ jQuery.extend({
}, },
hasAttr: function( elem, name ) { hasAttr: function( elem, name ) {
var inAttrs, attrs = elem.attributes;
if ( elem.hasAttribute ) { return elem.hasAttribute ?
return elem.hasAttribute( name ); elem.hasAttribute( name ) :
} else { (function() {
// Browsers do not understand the associative indexes, look for the name in elem.attributes.name // Some browsers do not understand the associative indexes
for ( var i = 0, l = attrs.length; i < l; i++ ) { // Look for the name in elem.attributes.name
var attrs = elem.attributes, i = 0, len = attrs.length;
for ( ; i < len; i++ ) {
if ( attrs[i]["name"] === name ) { if ( attrs[i]["name"] === name ) {
return true; return true;
} }
} }
} return false;
})();
}, },
attrHooks: { attrHooks: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment