Skip to main content

Bug Tracker

Side navigation

#12795 closed bug (duplicate)

Opened October 26, 2012 10:10PM UTC

Closed October 29, 2012 01:35PM UTC

Incorrect results using [selected] selector in IE8

Reported by: Motty Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:
Description

Starting with this HTML:

<select>
    <option>5</option>
    <option>10</option>
    <option>15</option>
    <option>20</option>
    <option>25</option>
</select>

The results of searching for option[selected] or option[selected="selected"], it should return a length of zero and zero (respectively) with undefined values.

In IE8 and older, this returns a length of one and one, with the same value as :selected. These results change with depending on the version of jQuery.

IE8
======
jQuery   :selected  [selected]    [selected="selected"]
version  len value  len value         len value
 1.2     1   "5"    1   "5"           0   undefined
 1.3     1   "5"    1   "5"           0   undefined
 1.4     1   "5"    0   undefined     1   "5"
 1.5     1   "5"    0   undefined     1   "5"
 1.6            -= jsFiddle error =-
 1.7     1   "5"    0   undefined     1   "5"
 1.8     1   "5"    1   "5"           1   "5"

expected 1   "5"    0   undefined     0   undefined

This issue may be related to http://bugs.jquery.com/ticket/8025 or http://bugs.jquery.com/ticket/10017

Here is the Fiddle I used: http://jsfiddle.net/Mottie/fSWre/4/

Attachments (0)
Change History (1)

Changed October 29, 2012 01:35PM UTC by timmywil comment:1

resolution: → duplicate
status: newclosed

Duplicate of #11115.I know it's not a perfect duplicate, but it is the same issue. Removing the boolHook would make this consistent, but unfortunately break user code because of our old ways.