OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | |
4 * { | |
5 background-color: papayawhip; | |
6 } | |
7 </style> | |
8 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
9 <script src="../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
10 <script> | 5 <script> |
| 6 |
11 function createShadowRoot() | 7 function createShadowRoot() |
12 { | 8 { |
13 var root = host.createShadowRoot(); | 9 var template = document.querySelector('#tmpl'); |
14 root.appendChild(document.createElement('content')); | 10 var root = document.querySelector('#host').webkitCreateShadowRoot(); |
15 var styles = document.createElement('style'); | 11 root.appendChild(template.content.cloneNode(true)); |
16 styles.textContent = '@host { * { border: 1px solid black; background-color:
red } } content::-webkit-distributed(div) { font-size: 24px }'; | |
17 root.appendChild(styles); | |
18 root.appendChild(document.createElement('content')); | |
19 } | 12 } |
20 | 13 |
21 function test() | 14 function test() |
22 { | 15 { |
23 InspectorTest.runTestSuite([ | 16 InspectorTest.runTestSuite([ |
24 function testInit(next) | 17 function testInit(next) |
25 { | 18 { |
26 WebInspector.settings.showShadowDOM.set(true); | 19 WebInspector.settings.showShadowDOM.set(true); |
27 InspectorTest.evaluateInPage("createShadowRoot()", callback); | 20 InspectorTest.evaluateInPage("createShadowRoot()", callback); |
28 function callback() | 21 function callback() |
29 { | 22 { |
30 InspectorTest.selectNodeAndWaitForStyles("host", next); | 23 InspectorTest.selectNodeAndWaitForStyles("inner", next); |
31 } | 24 } |
32 }, | 25 }, |
33 | 26 |
34 function testDumpStyles(next) | 27 function testDumpStyles(next) |
35 { | 28 { |
36 InspectorTest.dumpSelectedElementStyles(true); | 29 InspectorTest.dumpSelectedElementStyles(true); |
37 WebInspector.settings.showShadowDOM.set(false); | 30 WebInspector.settings.showShadowDOM.set(false); |
38 next(); | 31 next(); |
39 } | 32 } |
40 ]); | 33 ]); |
41 } | 34 } |
42 </script> | 35 </script> |
43 </head> | 36 </head> |
44 | 37 |
45 <body onload="runTest()"> | 38 <body onload="runTest()"> |
46 <p> | 39 <p> |
47 Tests that @host-provided styles are displayed in the Styles pane. <a href="http
s://bugs.webkit.org/show_bug.cgi?id=112664">Bug 112664</a> | 40 This test checks that style sheets hosted inside shadow roots |
| 41 could be inspected. |
48 </p> | 42 </p> |
49 | 43 <div id="host"></div> |
50 <div id="host" style="background-color: white;">Content</div> | 44 <template id="tmpl"> |
| 45 <style> .red { color: red; } </style> |
| 46 <div id="inner" class="red">hi!</div> |
| 47 </template> |
51 </body> | 48 </body> |
52 </html> | 49 </html> |
OLD | NEW |