css-scoping-shadow-root-hides-children.html (1077B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Scoping Module Level 1 - a shadow tree hides non-distributed children of the host</title> 5 <link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"/> 6 <link rel="help" href="http://www.w3.org/TR/css-scoping-1/#selectors-data-model"> 7 <link rel="match" href="reference/green-box.html"/> 8 </head> 9 <body> 10 <style> 11 my-host { 12 display: block; 13 width: 100px; 14 height: 100px; 15 } 16 div { 17 width: 100%; height: 100%; background: red; 18 } 19 </style> 20 <p>Test passes if you see a single 100px by 100px green box below.</p> 21 <my-host> 22 <div>FAIL</div> 23 </my-host> 24 <script> 25 26 try { 27 var shadowHost = document.querySelector('my-host'); 28 shadowRoot = shadowHost.attachShadow({mode: 'open'}); 29 shadowRoot.innerHTML = '<div style="width: 100px; height: 100px; background: green; color:green">FAIL</div>'; 30 } catch (exception) { 31 document.body.appendChild(document.createTextNode(exception)); 32 } 33 34 </script> 35 </body> 36 </html>