#360 closed bug (wontfix)
$('dd:nth-child(odd)') Doesn't select correctly
Reported by: | 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.
Change History (2)
comment:1 Changed 16 years ago by
Component: | ajax → core |
---|---|
Milestone: | 1.0 |
Version: | 1.0 |
comment:2 Changed 16 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
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: