Bug Tracker

Modify

Ticket #10074 (closed bug: fixed)

Opened 3 years ago

Last modified 22 months ago

Chaining two [] selector with :first not working

Reported by: ldng Owned by:
Priority: low Milestone: 1.8
Component: selector Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

Hi,

not sure it's a real bug but I was kinda expeting this to work : $('tr[id="foo"][style="display:none"]:first')

That would be selecting the first tr which name start with foo and has display style set to none.

Change History

comment:1 Changed 3 years ago by ldng

Happens both in Firefox 5 and Chrome 13 :  http://jsfiddle.net/d4QFg/

Another doubt is the list obtained with $('tr[id="foo"][style="display:none"]') sorted. I'm not sure that's always the case, hence the interest in a working :first selector chaining.

comment:2 Changed 3 years ago by rwaldron

  • Priority changed from undecided to low
  • Component changed from unfiled to selector
  • Milestone changed from None to 1.6.3

comment:3 Changed 3 years ago by rwaldron

Also,  http://api.jquery.com/first-selector/ has information regarding the performance losses you suffer with the :first selector.

comment:4 Changed 3 years ago by dmethvin

  • Status changed from new to open

The :first pushes Sizzle into the JavaScript code path rather than querySelectorAll. The JS path prefers the elem.style *property* (which is a CSSStyleDeclaration object) over the string style *attribute* of the element.

comment:5 Changed 3 years ago by dmethvin

  • Milestone 1.6.3 deleted

comment:6 Changed 22 months ago by timmywil

  • Status changed from open to closed
  • Resolution set to fixed
  • Milestone set to 1.8

This started working when jQuery.attr was plugged into sizzle, but now works in an independent Sizzle.

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.