css-scoping-shadow-slot-fallback.html (1350B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Scoping Module Level 1 - slot element without distributed nodes must render its fallback content</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 background-color: red; 14 width: 100px; 15 height: 50px; 16 } 17 .red { 18 background-color: red; 19 } 20 .green { 21 background-color: green; 22 } 23 div { 24 width: 100px; 25 height: 50px; 26 } 27 slot { 28 border: solid 10px red; 29 } 30 </style> 31 <p>Test passes if you see a single 100px by 100px green box below.</p> 32 <my-host></my-host> 33 <div class="red"><slot><div class="green"></div></slot></div> 34 <script> 35 36 try { 37 var shadowHost = document.querySelector('my-host'); 38 shadowRoot = shadowHost.attachShadow({mode: 'open'}); 39 shadowRoot.innerHTML = '<slot style="border: solid 10px red;">' 40 + '<div style="width: 100%; height: 100%; background-color: green;"></div></slot>'; 41 } catch (exception) { 42 document.body.appendChild(document.createTextNode(exception)); 43 } 44 45 </script> 46 </body> 47 </html>