Bug Tracker

Ticket #10499 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

: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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by dmethvin

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

comment:2 Changed 2 years ago by timmywil

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

comment:3 Changed 2 years ago by timmywil

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

comment:4 Changed 2 years ago by timmywil

  • Status changed from closed to reopened
  • Resolution fixed deleted

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

comment:5 Changed 2 years ago by timmywil

  • Status changed from reopened to assigned

comment:6 Changed 2 years ago by Timmy Willison

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

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

Changeset: 4039d3668decade6c7098f7f270c45dd54ff6a8c

Note: See TracTickets for help on using tickets.