CSS属性选择器+后裔给出了Webkit的错误? [英] CSS attribute selector + descendant gives a bug in Webkit?

查看:133
本文介绍了CSS属性选择器+后裔给出了Webkit的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑这个CSS:

[data-color="red"] h1 {
background-color:red;
}

[data-color="blue"] h1 {
background-color:blue;
}

和此HTML:

<div data-color="red">
<h1>red</h1>
</div>

<div data-color="blue">
<h1>blue</h1>
</div>

<div data-color="blue">
<h1>blue</h1>
</div>

现在来看看在Webkit的上述code和其他任何浏览器的下面的演示:结果
http://jsfiddle.net/aUCkn/

Now take a look at the following demo of the above code in Webkit and any other browser:
http://jsfiddle.net/aUCkn/

有什么奇怪的是,如果你把每个H1在同一行,即:

What's strange is that if you put each h1 on the same line, i.e.:

<div data-color="red"><h1>red</h1>
</div>

<div data-color="blue"><h1>blue</h1>
</div>

<div data-color="blue"><h1>blue</h1>
</div>

它的工作原理的Webkit太:结果
http://jsfiddle.net/aUCkn/1/

有谁知道这从何而来?难道我做错了什么,或者Webkit内核装傻吗?

Does anyone know where this comes from? Am I doing something wrong or is Webkit acting stupid here?

推荐答案

第一的jsfiddle在我的Chrome 12.0.742.112破碎(稳定)。

The first jsFiddle is broken in my Chrome 12.0.742.112 (stable).

然而,它在我的Chrome 14.0.803.0开发-M。

However, it works in my Chrome 14.0.803.0 dev-m.

所以,他们已经意识到,并有固定的错误。你只需要等待修复了稳定的渠道降落。

So, they're already aware of and have fixed the bug. You just have to wait for the fix to land in the stable channel.

我会尽力找到一个链接到一个bug报告,如果存在的话。

I'll try to find a link to a bug report, if one exists.

这篇关于CSS属性选择器+后裔给出了Webkit的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆