开发者

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:

Bug in WebKit: :last-child rule on non-existing element causes :nth-child havoc

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.

Bug in WebKit: :last-child rule on non-existing element causes :nth-child havoc

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜