remove-insertion-point-1.html (736B)
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 10 // Insertion point will match nothing and use fallback content. 11 var slot = document.createElement("slot"); 12 shadowDiv.appendChild(slot); 13 14 var shadowRoot = document.getElementById('outer').attachShadow({mode: 'open'}); 15 shadowRoot.appendChild(shadowDiv); 16 17 // Remove the insertion point from the ShadowRoot, "Hello" should no 18 // longer be rendered. 19 shadowDiv.removeChild(slot); 20 } 21 </script> 22 </head> 23 <body onload="tweak()"> 24 <div id="outer">Hello</div> 25 </body> 26 </html>