css-scoping-shadow-invisible-slot.html (1236B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Scoping Module Level 1 - elements with a distribution list should generate boxes in the formatting tree.</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 overflow: hidden; 16 } 17 div { 18 width: 100%; 19 height: 50%; 20 } 21 </style> 22 <p>Test passes if you see a single 100px by 100px green box below.</p> 23 <my-host> 24 <div slot="green" style="background: green;"></div> 25 <div style="background: red;">FAIL</div> 26 <div slot="green" style="background: green;"></div> 27 </my-host> 28 <script> 29 30 try { 31 var shadowHost = document.querySelector('my-host'); 32 shadowRoot = shadowHost.attachShadow({mode: 'open'}); 33 shadowRoot.innerHTML = '<slot name="green" style="border: solid 50px red;"></slot>'; 34 } catch (exception) { 35 document.body.appendChild(document.createTextNode(exception)); 36 } 37 38 </script> 39 </body> 40 </html>