Side navigation
#6341 closed bug (fixed)
Opened March 24, 2010 02:46AM UTC
Closed September 28, 2010 09:57PM UTC
$.attr(name, null) is inconsistent across browsers
Reported by: | DouglasMeyer | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | attributes | Version: | 1.4.2 |
Keywords: | null | Cc: | |
Blocked by: | Blocking: |
Description
Running $(...).attr(name, null) is inconsistent across browsers.
From what I can tell, most browsers (firefox/chrome) will remove the attribute; while ie (8) will set it to "null". For me this wasn't expected behavior, I expected the attribute to be removed (same as removeAttr).
#3058 was rejected because it was proposed as an enhancement (and the underlying bug wasn't apparent).
In #2548 flesler says passing null should be a setting (not getting) operation, but doesn't divulge what the attribute should be set to.
I'll get a diff soon.
I like the idea, it would allow adding and removing attributes with an object. The patch only implements this behavior for non-xml documents and attributes with matching DOM0 properties, I think it should apply more broadly.