sivakumaros2004
sivakumaros2004

Reputation: 21

using shadow dom in Internet Explorer

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>

Upvotes: 2

Views: 8571

Answers (1)

Andrey
Andrey

Reputation: 4050

Internet explorer (and new Edge browser) doesn't support shadow DOM natively. You can use polyfill to achieve desired behaviour.

Upvotes: 3

Related Questions