Modify ↓
Ticket #5543 (closed bug: invalid)
Pseudoelements :last-of-type and :first-of-type broken in certain contexts.
| Reported by: | Emmett | Owned by: | john |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | selector | Version: | 1.3.2 |
| Keywords: | psuedoelement | Cc: | |
| Blocking: | Blocked by: |
Description
With markup:
<table id="mytable">
<tbody>
<tr class="one">
<td></td>
</tr>
<tr class="two">
<td></td>
</tr>
</tbody>
</table>
This works properly:
$("#mytable tbody > tr:last-of-type"); // [ tr.two ]
But this will return all the tr nodes:
$("tbody >tr:last-of-type", "#mytable"); // [ tr.one, tr.two ]
So will this:
$("#mytable tbody").children("tr:last-of-type"); // [ tr.one, tr.two ]
:last-child works in all of these cases.
:first-of-type exhibits the exact same broken behaviour.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

There is no selector :last-of-type, it's :last or :first