Bug Tracker

Ticket #6341 (closed bug: fixed)

Opened 5 years ago

Last modified 4 years ago

$.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:


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.


Change History

Changed 5 years ago by DouglasMeyer

comment:1 Changed 5 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 4 years ago by john

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.