#118 closed bug (fixed)
Can't .attr('disabled', false);
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | 1.0 |
Component: | core | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In SVN 169, it's not possible to set an attribute to boolean false. The problem is in jQuery.fn.attr line 244 & 247:
return key.constructor != String || value ? : if ( value == undefined )
Since value is false in these cases it wrongly goes to the "return a value" case. Try this instead:
return key.constructor != String || value !== undefined ? : if ( value === undefined )
Also, in jQuery.attr line 1079, I would suggest this enhancement to allow "null" to be interpreted as removeAttribute, which would close bug 102 (http://proj.jquery.com/dev/bugs/bug/102/)
if ( v === null ) { o[a] = undefined; // can't use delete operator in IE if ( o.removeAttribute ) o.removeAttribute(a); } else if ( v != undefined ) { o[a] = v; if ( o.setAttribute && a != "disabled" ) o.setAttribute(a,v); }
I see a problem with Firefox 1.5 where a disabled button refuses to go back to gray after you explicitly set disabled=true on the button and then try disabled=false. The problem persists even if you remove the disabled attribute, and Firebug shows the attribute is still there. It looks like the check for "disabled" was intended to work around that, but neither the old or new code fixes it completely. Others have noticed it, seems to be a FF bug: http://www.milonic.com/mfa/2006-June/007562.html and https://bugzilla.mozilla.org/show_bug.cgi?id=149284
Change History (3)
comment:1 Changed 17 years ago by
Component: | ajax → core |
---|
comment:2 Changed 17 years ago by
Milestone: | → 1.0 |
---|---|
Version: | → 1.0 |
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This has been resolved in jQuery SVN.