admin管理员组文章数量:1429201
The below code works in chrome but not in Internet Explorer. Is there any way to use it in 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>
The below code works in chrome but not in Internet Explorer. Is there any way to use it in 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>
Share
Improve this question
asked Jul 30, 2015 at 10:02
sivakumaros2004sivakumaros2004
211 silver badge3 bronze badges
1
- not supported in IE11 – Jaromanda X Commented Jul 30, 2015 at 10:07
1 Answer
Reset to default 3Internet explorer (and new Edge browser) doesn't support shadow DOM natively. You can use polyfill to achieve desired behaviour.
本文标签: javascriptusing shadow dom in Internet ExplorerStack Overflow
版权声明:本文标题:javascript - using shadow dom in Internet Explorer - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745420981a2657897.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论