Bug Tracker

Opened 5 years ago

Closed 4 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 5 years ago by dmethvin

  • Component changed from unfiled to selector
  • Priority changed from undecided to low
  • Status changed from new to open

comment:2 Changed 4 years ago by timmywil

  • Milestone changed from None to 1.next
  • Owner set to timmywil
  • Status changed from open to assigned

comment:3 Changed 4 years ago by timmywil

  • Milestone changed from 1.next to 1.8
  • Resolution set to fixed
  • Status changed from assigned to closed

comment:4 Changed 4 years ago by timmywil

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:5 Changed 4 years ago by timmywil

  • Status changed from reopened to assigned

comment:6 Changed 4 years ago by Timmy Willison

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Changeset: 4039d3668decade6c7098f7f270c45dd54ff6a8c

Note: See TracTickets for help on using tickets.