Side navigation
#6723 closed bug (duplicate)
Opened June 25, 2010 03:01PM UTC
Closed March 31, 2011 03:24AM UTC
Last modified March 31, 2011 03:24AM UTC
:has fails in combination with :gt
Reported by: | acdha | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | selector | Version: | 1.4.4rc |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Assuming a list like:
<ul><li></li><li></li><li></li></ul>
expressions like jQuery("ul:has(li:gt(1)") will fail to match anything.
I was going to write a test-case but there's a nice one here which I couldn't find referenced in the bug tracker:
http://kruisit.nl/jquerybugs/?version=nightly
There is a workaround:
jQuery("ul").has("li:gt(1)")
or
jQuery("li:gt(1)").parent()
Attachments (0)
Change History (5)
Changed June 29, 2010 04:20PM UTC by comment:1
Changed November 01, 2010 08:36PM UTC by comment:2
milestone: | 1.4.3 |
---|---|
priority: | → low |
status: | new → open |
version: | 1.4.2 → 1.4.4rc |
Confirmed; http://jsfiddle.net/rwaldron/CS8Bm/1/
Changed March 30, 2011 08:39PM UTC by comment:3
milestone: | → 1.next |
---|
Changed March 31, 2011 03:24AM UTC by comment:4
resolution: | → duplicate |
---|---|
status: | open → closed |
Note for anyone else trying: the first workaround with .has() is not correct as it will match as long as there are more than the :gt() count elements anywhere on the entire page, not just under the selected <ul>. To get this to work reliably with jQuery 1.4.2 requires something like this: