Bug Tracker

Opened 12 years ago

Closed 12 years ago

#8820 closed bug (invalid)

attr("any",undefined) returns undefined

Reported by: fergusg Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:


Example (in Chrome debugger):

TypeError: Cannot call method 'css' of undefined

I would expect the same behaviour as attr("...",null), which returns the jQuery object.

Change History (2)

comment:1 Changed 12 years ago by fergusg

See: http://jsfiddle.net/2CPXk/ (that's only up to jQuery 1.5.1, but the same problem)

comment:2 Changed 12 years ago by timmywil

Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project! Passing undefined to attr is treated the same as not passing any value at all, thus treated as a getter. Use http://api.jquery.com/removeAttr to remove attributes.

Note: See TracTickets for help on using tickets.