Bug Tracker


Ticket #12337 (closed bug: fixed)

Opened 20 months ago

Last modified 19 months ago

:nth-child selector not accurate after new child element added

Reported by: bobbymwalters@… Owned by: gibson042
Priority: high Milestone: 1.8.2
Component: selector Version: 1.8.0
Keywords: Cc:
Blocking: Blocked by:


Using the :nth-child selector after a new child element has been added to a parent isn't working correctly in 1.8.0. However, with 1.7.2 the same scenario works as expected.

A test for using .find vs .children was added as well because in 1.7.2 using .children('.class:nth-child(NUMBER)') was significantly faster in Internet Explorer.

It seems the .find vs .children is also being handled differently. Using 1.8.0 the .find variant works in Chrome 21.0.1180.79 but .children remains incorrect.

I've only ran this against Internet Explorer 8 and Chrome 21.0.1180.79. Thanks for your time!

jsFiddle:  http://jsfiddle.net/yVe4H/1/

Change History

comment:1 Changed 20 months ago by dmethvin

  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Component changed from unfiled to traversing
  • Milestone changed from None to 1.8.1

Confirmed. Here's an updated fiddle:  http://jsfiddle.net/dmethvin/yVe4H/2/

comment:2 Changed 20 months ago by timmywil

  • Status changed from open to closed
  • Resolution set to duplicate
  • Component changed from traversing to selector

Duplicate of #12205.

comment:3 Changed 19 months ago by gibson042

  • Priority changed from blocker to high
  • Status changed from closed to reopened
  • Resolution duplicate deleted
  • Milestone changed from 1.8.1 to 1.8.2

comment:4 Changed 19 months ago by gibson042

  • Owner set to gibson042
  • Status changed from reopened to assigned

comment:5 Changed 19 months ago by dmethvin

#12474 is a duplicate of this ticket.

comment:6 Changed 19 months ago by Timmy Willison

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

Update Sizzle: fix position caching with child selectors. Fixes #12337.

Changeset: 99f4825707e2bf6f19598a00f53d58ef3878190c

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.