Ticket #5805 (closed bug: fixed)
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: | ||
| Blocking: | Blocked by: |
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.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

These issues seem to be fixed in 1.4: http://jsfiddle.net/8hGDB/