Skip to main content

Bug Tracker

Side navigation

#5805 closed bug (fixed)

Opened January 14, 2010 09:57PM UTC

Closed January 15, 2010 01:59AM UTC

Odd behavior when trying to select option elements with the "selected" attribute.

Reported by: supster Owned by: john
Priority: minor Milestone:
Component: selector Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

In short, the problem is that the following two lines do not select the same elements, even though as far as I understand, they should.

$("select option[selected=selected]")

$("option[selected=selected]", $("select"))

The fist correctly matches option elements where the "selected" attribute has the value of "selected", whereas the second does not match *any* elements.

I also notice that the "[selected]" attribute does not actually match the element that has an attribute with the name of "selected", but rather is equivalent to the ":selected" selector. This is rather inconsistent and seems undocumented.

Attachments (0)
Change History (2)

Changed January 14, 2010 10:05PM UTC by supster comment:1

These issues seem to be fixed in 1.4:

http://jsfiddle.net/8hGDB/

Changed January 15, 2010 01:59AM UTC by dmethvin comment:2

resolution: → fixed
status: newclosed

I'll close the ticket since it's reported as fixed in 1.4.