Skip to main content

Bug Tracker

Side navigation

#14631 closed bug (invalid)

Opened December 12, 2013 09:00AM UTC

Closed January 03, 2014 08:50AM UTC

nth-last-child selector behaves differently in webkit (chrome)

Reported by: avanderw@gmail.com Owned by: avanderw@gmail.com
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

I was originally using the below code to get the last 16 elements and put them in front of the other nodes (paging)

query("#links a:nth-last-child(-n+16)").prependTo(query("#links")).show(0);

Which works on IE and FF but does not behave correctly in Chrome

I lazily modified the above to

query("#links a").slice(query("#links a").length - 16).prependTo(query("#links")).show(0);

Which works fine. I suspect this is a bug with webkit, based of all the nth-child bugs previously filed. This is just a reminder to possibly fix the nth-last-child as well.

Attachments (0)
Change History (3)

Changed December 19, 2013 07:01PM UTC by timmywil comment:1

owner: → avanderw@gmail.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the "jQuery(edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read:

Additional resources:

Changed December 20, 2013 07:01AM UTC by anonymous comment:2

It seems that the case I have might not related to the nth-last-child selector but to something else.

Here everything is working...

http://jsfiddle.net/FrKyN/

Yet I had to change the previous to the below to get it to work in chrome (note jquery is embedded as query)...

query("#links a").slice(query("#links a").length - 16).prependTo(query("#links")).show(0);

Changed January 03, 2014 08:50AM UTC by trac-o-bot comment:3

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!