css-scoping-shadow-assigned-node-with-before-after.html (1664B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Scoping Module Level 1 - ::before and ::after pseudo class' contents on a node assigned to a slot element must be rendered</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 background: red; 16 } 17 div { 18 display: block; 19 background: red; 20 line-height: 0px; 21 width: 100%; 22 height: 50px; 23 } 24 [slot=foo]::before, 25 [slot=foo]::after { 26 display: block; 27 content: ""; 28 width: 100%; 29 height: 25px; 30 } 31 [slot=foo]::before, 32 [slot=foo]::after { 33 background: green; 34 } 35 [slot=bar]::before, 36 [slot=bar]::after { 37 background: yellow; 38 } 39 </style> 40 <p>Test passes if you see a single 100px by 100px green box below.</p> 41 <my-host> 42 <div slot="foo"></div> 43 <div slot="bar"></div> 44 <div slot="foo"></div> 45 </my-host> 46 <script> 47 48 try { 49 var shadowHost = document.querySelector('my-host'); 50 shadowRoot = shadowHost.attachShadow({mode: 'open'}); 51 shadowRoot.innerHTML = '<slot name="foo"></slot>'; 52 } catch (exception) { 53 document.body.appendChild(document.createTextNode(exception)); 54 } 55 56 </script> 57 </body> 58 </html>