Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8303 closed bug (duplicate)

:gt() inside :has()

Reported by: sime.vidas@… Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

This code:

$('ul:has(li:gt(2))')

selects all UL elements that have more than 3 children.

Check out this demo: http://jsfiddle.net/RQBuZ/1/

As you can see, the above code works - all UL's with more than 3 children have a yellow background-color.

However, the demo uses jQuery 1.2.6. If you switch to any of the more recent versions of jQuery, the code stops working.

Change History (3)

comment:1 Changed 9 years ago by anonymous

Also, note that this selector:

'ul:has(li:nth-child(4))'

has the same functionality as the above selector. And this selector also only works in 1.2.6 but not any more recent version of jQuery.

Demo: http://jsfiddle.net/RQBuZ/2/


Just to make sure that we agree on the semantics of the selector:

'ul:has(li:nth-child(4))'

Select all UL elements which contain at least one LI element which is the 4-th child (of its parent).

Therefore, in the demo that I supplied above, the last two UL elements should be selected by this selector, but they're not.

comment:2 Changed 9 years ago by snover

Resolution: duplicate
Status: newclosed

comment:3 Changed 9 years ago by snover

Duplicate of #8132.

Note: See TracTickets for help on using tickets.