Bug in WebKit: :last-child rule on non-existing element causes :nth-child havoc
When an empty last-child
rule is applied to all td
tags while a tr
tag does not contain any, the nth-child
rules are not applied correctly.
For example, this CSS:
tr:nth-child(odd) td {
background: #27d;
}
tr:last-child td:last-child {
}
with this HTML:
<table>
<tr><th colspan="10"></th></tr>
<tr><td></td>[10 times]</tr>
<tr><td></td>[10 times]</tr>
...
</table>
works correctly in Firefox 5.0.1 (it prints alternatively blue and white lines) and Safari 5 but not in Safari 5.1 and Chrome 13.0.782.215:
http://www.jill-jenn.net/drafts/zebra-striping/
Something even more surprising: when you embed the CSS code instead of linking to it, the behavior is different in WebKit.
http://ww开发者_StackOverflow中文版w.jill-jenn.net/drafts/zebra-striping/nolink.html
I already made a ticket on Apple's Bug Reporter, but I wanted to know if anyone had found something similar.
精彩评论