Fixed bug with $.attr(), it was attempting to set attribute even if you're attempting to access a value. This was due to the !== null fix.

This commit is contained in:
John Resig 2006-05-17 18:46:51 +00:00
parent 3386923dcc
commit c75701a015

2
jquery/jquery.js vendored
View File

@ -573,7 +573,7 @@ $.attr = function(o,a,v){
a = (fix[a] && fix[a].replace && fix[a]) || a;
var r = new RegExp("-([a-z])","ig");
a = a.replace(r,function(z,b){return b.toUpperCase();});
if ( v !== null ) {
if ( typeof v != 'undefined' ) {
o[a] = v;
if ( o.setAttribute ) {
o.setAttribute(a,v);