[英]using shadow dom in Internet Explorer
以下代码在chrome中有效,但在Internet Explorer中不起作用。 有没有办法在Internet Explorer中使用它?
<html>
<head></head>
<body>
<div>
<h4>My Content Heading</h4>
<p>My content text</p>
</div>
<script>
var myContent = document.querySelector('div');
var shadowroot = myContent.createShadowRoot();
shadowroot.innerHTML =
'<h2>Inserted Heading</h2> <content select="p"></content>';
</script>
</body>
</html>
Internet Explorer(和新的Edge浏览器)本机不支持影子DOM。 您可以使用polyfill实现所需的行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.