OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
4 <script type="text/javascript" src="css-protocol-test.js"></script> | 4 <script type="text/javascript" src="css-protocol-test.js"></script> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 function test() | 6 function test() |
7 { | 7 { |
8 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled); | 8 var documentNodeId; |
| 9 |
| 10 InspectorTest.requestDocumentNodeId(onDocumentNodeId); |
| 11 |
| 12 function onDocumentNodeId(nodeId) |
| 13 { |
| 14 documentNodeId = nodeId; |
| 15 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled); |
| 16 } |
9 | 17 |
10 function onCSSEnabled() | 18 function onCSSEnabled() |
11 { | 19 { |
12 InspectorTest.requestNodeId("#shadow-host", onNodeReceived); | 20 InspectorTest.requestNodeId(documentNodeId, "#shadow-host", onNodeReceiv
ed); |
13 } | 21 } |
14 | 22 |
15 function onNodeReceived(nodeId) | 23 function onNodeReceived(nodeId) |
16 { | 24 { |
17 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, InspectorTest.comp
leteTest.bind(InspectorTest)); | 25 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, InspectorTest.comp
leteTest.bind(InspectorTest)); |
18 } | 26 } |
19 } | 27 } |
20 </script> | 28 </script> |
21 <template id="shadow-template"> | 29 <template id="shadow-template"> |
22 <style> | 30 <style> |
23 :host { | 31 :host { |
24 color: red; | 32 color: red; |
25 } | 33 } |
26 </style> | 34 </style> |
27 <div>Hi!</div> | 35 <div>Hi!</div> |
28 </template> | 36 </template> |
29 </head> | 37 </head> |
30 <body> | 38 <body> |
31 <div id="shadow-host"></div> | 39 <div id="shadow-host"></div> |
32 <script> | 40 <script> |
33 var host = document.querySelector("#shadow-host").createShadowRoot(); | 41 var host = document.querySelector("#shadow-host").createShadowRoot(); |
34 var template = document.querySelector("#shadow-template"); | 42 var template = document.querySelector("#shadow-template"); |
35 host.appendChild(template.content); | 43 host.appendChild(template.content); |
36 template.remove(); | 44 template.remove(); |
37 runTest(); | 45 runTest(); |
38 </script> | 46 </script> |
39 </body> | 47 </body> |
40 </html> | 48 </html> |
OLD | NEW |