shadow-root-insert-into-document.html (655B)
1 <!doctype html> 2 <title>CSS Scoping Module Level 1 - Dynamic insertion of shadow host</title> 3 <link rel="author" href="mailto:emilio@crisal.io"> 4 <link rel="help" href="https://drafts.csswg.org/css-scoping/#selectors-data-model"> 5 <link rel="match" href="reference/green-box.html"/> 6 <p>Test passes if you see a single 100px by 100px green box below.</p> 7 <script> 8 let host = document.createElement('div'); 9 let root = host.attachShadow({ mode: 'open' }); 10 root.innerHTML = ` 11 <style> 12 div { background: green; width: 100px; height: 100px; } 13 </style> 14 <div></div> 15 `; 16 document.body.offsetTop; 17 document.body.appendChild(host); 18 </script>