Bug Tracker

Opened 6 years ago

Closed 5 years ago

#10499 closed bug (fixed)

:nth-child() inside :has() treated as if outside it

Reported by: BoltClock Owned by: timmywil
Priority: low Milestone: 1.8
Component: selector Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:

Description

This selector statement:

$('E:has(F:nth-child(n))')

is treated as:

$('E:nth-child(n):has(F)')

for any n.

The equivalent statement using the .has() method works correctly, finding E with an nth child that is F:

$('E').has('F:nth-child(n)')

In-depth test case: http://jsfiddle.net/BoltClock/tbUdq

Tested on latest versions of all major browsers.

Also affects jQuery 1.7b2.

This closed ticket seems related: http://bugs.jquery.com/ticket/4169

Change History (6)

comment:1 Changed 6 years ago by dmethvin

Component: unfiledselector
Priority: undecidedlow
Status: newopen

comment:2 Changed 5 years ago by timmywil

Milestone: None1.next
Owner: set to timmywil
Status: openassigned

comment:3 Changed 5 years ago by timmywil

Milestone: 1.next1.8
Resolution: fixed
Status: assignedclosed

comment:4 Changed 5 years ago by timmywil

Resolution: fixed
Status: closedreopened

This wasn't actually fixed, just changed. Fix incoming.

comment:5 Changed 5 years ago by timmywil

Status: reopenedassigned

comment:6 Changed 5 years ago by Timmy Willison

Resolution: fixed
Status: assignedclosed

Sizzle: fix a small bug with combinator cache. Fixes #10499.

Changeset: 4039d3668decade6c7098f7f270c45dd54ff6a8c

Note: See TracTickets for help on using tickets.