IE7是否支持HTML5数据标签? [英] Does IE7 support HTML5 data tag?
问题描述
我愿意使用如下数据标签。
I'm willing to use data tag as below.
<div data-color="#1337c"></div>
我使用jquery来获取( $( div)。data(color);
)和 store ($(div)。data(color,红色);
)以及操纵数据。
I use jquery to fetch($("div").data("color");
) and store($("div").data("color", "red");
) as well as manipulate data.
- IE7是否支持以上标签?
- HTML5的浏览器要求是什么?
谢谢
推荐答案
回答真实问题: jQuery.data
在IE7 ..和IE6中按预期工作。(没有HTML5或官方需要数据属性支持。)
To answer the real question: jQuery.data
works as expected in IE7 .. and IE6. (No HTML5 or official "data attribute" support required.)
IE7将很乐意保留HTML中提供的任何属性,并在DOM中将其公开。它是否被称为 data-foo
或 foo-data
并不重要。我认为这在技术上违背了HTML4规范,但它是我所知道的每个主要浏览器的行为。
IE7 will happily keep any attribute supplied in the HTML and expose it as such in the DOM. It doesn't matter if it is called data-foo
or foo-data
. I believe this is technically against the HTML4 specification, but it is the behavior of every major browser I know.
请注意, 数据(foo)
和 attr(data-foo)
具有不同的语义。
Do be aware, however, that data("foo")
and attr("data-foo")
have different semantics.
这篇关于IE7是否支持HTML5数据标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!