OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="resources/shadow-dom.js"></script> |
| 5 <script src="../../../resources/js-test.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <div id="sandbox"></div> |
| 9 <pre id="console"></pre> |
| 10 <script> |
| 11 |
| 12 function colorOf(node) |
| 13 { |
| 14 return document.defaultView.getComputedStyle(node, null).getPropertyValue('c
olor'); |
| 15 } |
| 16 |
| 17 function cleanUp() |
| 18 { |
| 19 document.getElementById('sandbox').innerHTML = ''; |
| 20 } |
| 21 |
| 22 var sandbox = document.getElementById('sandbox'); |
| 23 sandbox.appendChild( |
| 24 createDOM('div', {'id': 'host'}, |
| 25 createShadowRoot( |
| 26 createDOM('content', {'select': '#host-child1'}), |
| 27 createDOM('div', {}, |
| 28 createDOM('content', {'select': '#host-child2'}), |
| 29 createDOM('style', {'scoped': 'scoped'}, |
| 30 document.createTextNode('content /content/ div { color: gree
n; }')))), |
| 31 createDOM('div', {'id': 'host-child1'}, |
| 32 document.createTextNode('normal')), |
| 33 createDOM('div', {'id': 'host-child2'}, |
| 34 document.createTextNode('green')))); |
| 35 |
| 36 shouldNotBe('colorOf(document.querySelector("#host > div#host-child1"))', '"rgb(
0, 128, 0)"'); |
| 37 shouldBe('colorOf(document.querySelector("#host > div#host-child2"))', '"rgb(0,
128, 0)"'); |
| 38 |
| 39 cleanUp(); |
| 40 </script> |
| 41 </body> |
| 42 </html> |
OLD | NEW |