Side navigation
#10074 closed bug (fixed)
Opened August 17, 2011 03:03PM UTC
Closed June 19, 2012 06:13AM UTC
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: | ||
Blocked by: | Blocking: |
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.
Attachments (0)
Change History (6)
Changed August 17, 2011 03:23PM UTC by comment:1
Changed August 17, 2011 05:23PM UTC by comment:2
component: | unfiled → selector |
---|---|
milestone: | None → 1.6.3 |
priority: | undecided → low |
Further reduction: http://jsfiddle.net/rwaldron/jcWN7/
Changed August 17, 2011 05:30PM UTC by comment:3
Also, http://api.jquery.com/first-selector/ has information regarding the performance losses you suffer with the :first
selector.
Changed August 18, 2011 02:55PM UTC by comment:4
status: | new → 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.
Changed August 22, 2011 05:57PM UTC by comment:5
milestone: | 1.6.3 |
---|
Changed June 19, 2012 06:13AM UTC by comment:6
milestone: | → 1.8 |
---|---|
resolution: | → fixed |
status: | open → closed |
This started working when jQuery.attr was plugged into sizzle, but now works in an independent Sizzle.
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.