Side navigation
#6358 closed bug (patchwelcome)
Opened March 26, 2010 02:57AM UTC
Closed September 12, 2011 02:46AM UTC
Has attribute "selected" shows different behavior with context vs. without.
Reported by: | l_andrew_l | Owned by: | timmywil |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | selector | Version: | 1.4.2 |
Keywords: | select | Cc: | |
Blocked by: | Blocking: |
Description
I've tracked this bug down to the following problem:
Place a <select> element into an HTML page with an <option> element. Do not add the "selected" attribute.
var sel = $('select');
$('select option[selected]');
$('option[selected]', sel);
Both of these return different results. Using context contains the option element even though there is no selected attribute.
Using Firefox 3.5.3 on Ubuntu with Firebug 1.5.3.
Attachments (0)
Change History (6)
Changed June 15, 2010 01:04AM UTC by comment:1
component: | unfiled → selector |
---|
Changed November 11, 2010 03:15AM UTC by comment:2
milestone: | 1.4.3 → 1.4.5 |
---|---|
priority: | → high |
status: | new → open |
http://jsfiddle.net/dmethvin/UtAus/ I get consistent and correct results with Firefox 3.5, Opera 10, Chrome 7, and Safari 5. However, IE8 does not correctly return a selected option for
#tock. This behavior seems to have changed between 1.4.2 and 1.4.3 only for IE.
Changed May 07, 2011 02:29AM UTC by comment:3
blockedby: | → 5637 |
---|
Changed July 12, 2011 04:05PM UTC by comment:4
milestone: | 1.next → 1.7 |
---|---|
owner: | → timmywil |
status: | open → assigned |
Changed September 12, 2011 02:46AM UTC by comment:5
blockedby: | 5637 |
---|
Changed September 12, 2011 02:46AM UTC by comment:6
resolution: | → patchwelcome |
---|---|
status: | assigned → closed |
This is an issue with IE8's qsa. I don't know why it messes up, but it is not really an issue with Sizzle. I don't think we can fix it without defacing qsa Sizzle. It would mean an additional support test and a solo attribute check just for [selected] in IE8. I don't think we want the performance hit so I suggest this should stay the way it is. This works in all browsers if selected is set to "selected":
[selected="selected"]
Closing patchwelcome, but I'm of the opinion the extra code is not worth it.