shadow-assign-dynamic-001.html (919B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Scoping Module Level 1 - Dynamic mutations to both shadow root and shadow host subtrees</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="help" href="https://drafts.csswg.org/css-scoping/#selectors-data-model"> 6 <link rel="help" href="https://bugzil.la/1303605"> 7 <link rel="match" href="reference/green-box.html"/> 8 <p>Test passes if you see a single 100px by 100px green box below.</p> 9 <style> 10 #host { 11 width: 100px; 12 height: 100px; 13 background: red; 14 } 15 16 #host > div { 17 width: 100px; 18 height: 50px; 19 background: green; 20 } 21 </style> 22 <div id="host"></div> 23 <script> 24 let root = host.attachShadow({ mode: "open" }); 25 document.body.offsetTop; 26 27 root.innerHTML = `<slot name="slot1"></slot><slot name="slot2"></slot>`; 28 host.innerHTML = `<div slot="slot1"></div><div slot="slot2"></div>`; 29 </script>