Skip to main content

Bug Tracker

Side navigation

#360 closed bug (wontfix)

Opened November 07, 2006 05:11AM UTC

Closed November 17, 2006 08:15PM UTC

Last modified June 20, 2007 01:28AM UTC

$('dd:nth-child(odd)') Doesn't select correctly

Reported by: gavinmroy@gmail.com Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: nth-child() dd dt Cc:
Blocked by: Blocking:
Description

I'm trying to use nth-child on elements of a dl but it's not selecting the correctly.

Output from firebug:

>>> $('#TEngineInformation dd');
[<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>]

>>> $('#TEngineInformation dd:nth-child(odd)');
[<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>]

>>> $('#TEngineInformation dd:nth-child(even)');
[]

>>> $('#TEngineInformation dt');
[<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>]

>>> $('#TEngineInformation dt:nth-child(odd)');
[]

>>> $('#TEngineInformation dt:nth-child(even)');
[<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>]

From that example it looks as if it's only looking at children of the dl itself for even and odd not the dd or dt.

Attachments (0)
Change History (2)

Changed November 07, 2006 11:39AM UTC by joern comment:1

component: ajaxcore
milestone: 1.0
version: 1.0

Changed November 17, 2006 08:15PM UTC by john comment:2

resolution: → wontfix
status: newclosed

This is correct - and the way its expected to work in CSS. To do what you want, you would use :nth-of-type(odd). But I removed that particular selector a while back, since no one seemed interested in using it.

For now, you can simulate your particular result by doing:

  $('#TEngineInformation dd:odd')