remove-insertion-point-1.html 736 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <script>
  5. function tweak() {
  6. // div with style "border: 10px solid green"
  7. var shadowDiv = document.createElement("div");
  8. shadowDiv.style.border = "10px solid green";
  9. // Insertion point will match nothing and use fallback content.
  10. var slot = document.createElement("slot");
  11. shadowDiv.appendChild(slot);
  12. var shadowRoot = document.getElementById('outer').attachShadow({mode: 'open'});
  13. shadowRoot.appendChild(shadowDiv);
  14. // Remove the insertion point from the ShadowRoot, "Hello" should no
  15. // longer be rendered.
  16. shadowDiv.removeChild(slot);
  17. }
  18. </script>
  19. </head>
  20. <body onload="tweak()">
  21. <div id="outer">Hello</div>
  22. </body>
  23. </html>