2d5a40312fbf1c29003861dd58431c3b7d65cf9b
[WebKit-https.git] / LayoutTests / fast / shadow-dom / css-scoping-shadow-with-rules.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>CSS Scoping - a selector inside a shadow tree is matched against nodes in the shadow 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     }
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>FAIL</div><style> div {width: 100px; height: 100px; background: green; color:green; } </style>';
30     } catch (exception) {
31         document.body.appendChild(document.createTextNode(exception));
32     }
33
34     </script>
35 </body>
36 </html>