OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <template id="shadow-template"> | |
4 <div style="color: red;"><h1>Hello from the shadow dom!</h1></div> | |
5 </template> | |
6 </head> | |
7 <body onload="addShadowDOM()"> | |
8 <div id="element_in_an_iframe"></div> | |
9 <script> | |
10 function addShadowDOM() { | |
11 var host = document.getElementById("element_in_an_iframe").createShadowRoot( ); | |
12 var template = document.querySelector("#shadow-template"); | |
13 host.appendChild(template.content); | |
14 template.remove(); | |
15 } | |
16 </script> | |
17 </body> | |
18 </html> | |
OLD | NEW |