Bug Tracker

Modify

Ticket #9269 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

$.attr bug in IE

Reported by: dh20156@… Owned by: timmywil
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

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

 http://jsfiddle.net/KdpTr/

or you can test it directly from:

 http://www.jslab.org.cn/?tag=JQueryAttrBugInIE

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

comment:1 Changed 2 years ago by rwaldron

  • Owner set to timmywil
  • Status changed from new to assigned
  • Component changed from unfiled to attributes

comment:2 Changed 2 years ago by timmywil

  • Priority changed from undecided to low
  • Status changed from assigned to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.