Bug Tracker

Opened 14 years ago

Closed 13 years ago

#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:
Blocked by: Blocking:


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 (1)

0001-Ensure-attr-name-null-works-consistently-across-brow.patch (1.7 KB) - added by DouglasMeyer 14 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 13 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.

comment:2 Changed 13 years ago by john

Priority: undecided
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.