OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startHTML(` |
| 3 <div id='host'></div> |
| 4 <template id='tmpl'> |
| 5 <style> .red { color: red; } </style> |
| 6 <div id='inner' class='red'>hi!</div> |
| 7 </template> |
| 8 `, 'This test checks that style sheets hosted inside shadow roots are reported
in CSS.styleSheetAdded event.'); |
| 9 |
| 10 await session.evaluate(` |
| 11 var template = document.querySelector('#tmpl'); |
| 12 var root = document.querySelector('#host').createShadowRoot(); |
| 13 root.appendChild(template.content.cloneNode(true)); |
| 14 `); |
| 15 |
| 16 dp.DOM.enable(); |
| 17 dp.CSS.enable(); |
| 18 var msg = await dp.CSS.onceStyleSheetAdded(); |
| 19 var styleSheetHeader = msg.params.header; |
| 20 var payload = await dp.CSS.getStyleSheetText({styleSheetId: styleSheetHeader.s
tyleSheetId}); |
| 21 testRunner.log('Loaded style sheet text: ' + payload.result.text); |
| 22 testRunner.completeTest(); |
| 23 }) |
OLD | NEW |