Bug Tracker

Modify

Ticket #5805 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

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

comment:1 Changed 3 years ago by supster

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

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

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

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.