我有两个关于自定义HTML标记的问题。
当我创建自定义HTML标记并在不同浏览器中尝试此自定义HTML文件(下面的代码)时。我想知道是否有人可以在旧版本的Safari中测试这个,看看与自定义HTML标签的兼容性。
您是否需要在这些文章中提到这些额外的JavaScript内容?
https://www.html5rocks.com/en/tutorials/webcomponents/customelements/
https://developers.google.com/web/fundamentals/architecture/building-components/customelements
<style>
custom-tag {
background-color: red;
padding: 100px;
}
</style>
<custom-tag>This is a custom tag.</custom-tag>
<script>
alert(document.getElementsByTagName('custom-tag')[0].tagName)
</script>
此代码在Internet Explorer中的结果......
IE6 = JS Works但不是CSS
IE7 = JS Works但不是CSS
IE8 = JS Works但不是CSS
IE9 = JS Works但不是CSS
IE10 + =全面工作
答案 0 :(得分:0)
根据 CanIUse ,仅支持自定义元素:
dom.webcomponents.enabled
中的about:config
首选项)不支持:
这与 working draft (最后更新于2016年10月13日)有关。 CanIUse很可能尚未更新以涵盖草案的最新版本。
希望这有帮助!