Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9269 closed bug (invalid)

$.attr bug in IE

Reported by: [email protected] Owned by: timmywil
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


Guys, we found there is a bug of $.attr in IE. you can duplicate it as below test case:


or you can test it directly from:


When we set a boolean value(true) via $.attr, and then we compare(===) the value that get from $.attr again with true, it will be failured.

Change History (2)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledattributes
Owner: set to timmywil
Status: newassigned

comment:2 Changed 12 years ago by timmywil

Priority: undecidedlow
Resolution: invalid
Status: assignedclosed

It has never been the case that you could compare the return values with strict equal to true or false. You can do

if ( $('#foo').attr('selected') ) { /* Do something */ }

getAttribute will not consistently return a boolean either because you can only set attributes to strings. I look at your fiddle in Chrome and see that getAttribute returns a string (as it should). If you get back a boolean, it's a browser bug. jQuery normalizes all of them to a strings.

Note: See TracTickets for help on using tickets.