Commit 2a8a2b61 authored by timmywil's avatar timmywil

Move the if statement in jQuery.fn.removeAttr to jQuery.removeAttr

- Extra testing on removeAttr and IE form weirdness( all good )
parent ff757675
...@@ -16,9 +16,7 @@ jQuery.fn.extend({ ...@@ -16,9 +16,7 @@ jQuery.fn.extend({
removeAttr: function( name ) { removeAttr: function( name ) {
return this.each(function() { return this.each(function() {
if ( this.nodeType === 1 ) {
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}
}); });
}, },
...@@ -335,16 +333,18 @@ jQuery.extend({ ...@@ -335,16 +333,18 @@ jQuery.extend({
}, },
removeAttr: function( elem, name ) { removeAttr: function( elem, name ) {
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name; name = jQuery.attrFix[ name ] || name;
if ( jQuery.support.getSetAttribute ) { if ( jQuery.support.getSetAttribute ) {
elem.removeAttribute( name ); elem.removeAttribute( name );
} else { } else {
// Set to default empty string // Set to default empty string (No longer need to use attr for this)
elem.setAttribute( name, "" ); elem.setAttribute( name, "" );
// Attempt to remove completely with DOM level 1 // Attempt to remove completely with DOM level 1
elem.removeAttributeNode( elem.getAttributeNode( name ) ); elem.removeAttributeNode( elem.getAttributeNode( name ) );
} }
}
}, },
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