Make .attr(name, null) equivalent to removeAttr(name). (Was roughly this before - but is now consistent across platforms). Fixes #6341.
This commit is contained in:
parent
cf672a2e7a
commit
c7c0677230
2 changed files with 14 additions and 2 deletions
|
@ -295,7 +295,14 @@ jQuery.extend({
|
|||
jQuery.error( "type property can't be changed" );
|
||||
}
|
||||
|
||||
elem[ name ] = value;
|
||||
if ( value === null ) {
|
||||
if ( elem.nodeType === 1 ) {
|
||||
elem.removeAttribute( name );
|
||||
}
|
||||
|
||||
} else {
|
||||
elem[ name ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// browsers index elements by id/name on forms, give priority to attributes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue