git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make .attr(name, null) equivalent to removeAttr(name). (Was roughly this before ...
[jquery.git]
/
src
/
attributes.js
diff --git
a/src/attributes.js
b/src/attributes.js
index
cb9f2cf
..
ec4841b
100644
(file)
--- a/
src/attributes.js
+++ b/
src/attributes.js
@@
-295,7
+295,14
@@
jQuery.extend({
jQuery.error( "type property can't be changed" );
}
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.
}
// browsers index elements by id/name on forms, give priority to attributes.