386310-1d-shadow.html (786B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="386310-script.js"></script> 5 <script> 6 customElements.define("custom-element", class extends HTMLElement { 7 constructor() { 8 super(); 9 const template = document.getElementById("template"); 10 const shadowRoot = this.attachShadow({mode: "open"}) 11 .appendChild(template.content.cloneNode(true)); 12 var span = document.createComment("generated comment to prevent bug #36"); 13 this.insertBefore(span, this.firstChild); 14 } 15 }); 16 </script> 17 </head> 18 <body> 19 <template id="template"> 20 <span></span> 21 <slot></slot> 22 </template> 23 <custom-element id="test" style="display: block;">first second third [fourth]</custom-element> 24 </body> 25 </html>