Ticket #6341 (closed bug: fixed)
$.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: | |
| Blocking: | Blocked by: |
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.
Attachments
Change History
Changed 3 years ago by DouglasMeyer
-
attachment
0001-Ensure-attr-name-null-works-consistently-across-brow.patch
added
comment:1 Changed 3 years ago by dmethvin
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
