OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script> |
| 6 description("Tests that <style scoped> is correctly applied as child of a Sh
adowRoot, and that it doesn't leak out. Can only run within DRT."); |
| 7 |
| 8 function test() |
| 9 { |
| 10 if (window.testRunner) |
| 11 testRunner.dumpAsText(); |
| 12 |
| 13 var a = document.getElementById("A"); |
| 14 var b = document.getElementById("B"); |
| 15 shadow = b.createShadowRoot(); |
| 16 shouldBeDefined("shadow.innerHTML"); |
| 17 shouldBeDefined("shadow.getElementById"); |
| 18 shadow.innerHTML = "<style scoped>div { color: red; }</style><content></
content><div id='C'>CCC</div>"; |
| 19 var c = shadow.getElementById("C"); |
| 20 var d = document.getElementById("D"); |
| 21 |
| 22 debug("A: " + document.defaultView.getComputedStyle(a, null).getProperty
Value('color')); /* black */ |
| 23 debug("B: " + document.defaultView.getComputedStyle(b, null).getProperty
Value('color')); /* red */ |
| 24 debug("C: " + document.defaultView.getComputedStyle(c, null).getProperty
Value('color')); /* red */ |
| 25 debug("D: " + document.defaultView.getComputedStyle(d, null).getProperty
Value('color')); /* black */ |
| 26 } |
| 27 </script> |
| 28 </head> |
| 29 <body> |
| 30 <div id="A"> |
| 31 AAA |
| 32 </div> |
| 33 <div id="B"> |
| 34 BBB |
| 35 </div> |
| 36 <div id="D"> |
| 37 DDD |
| 38 </div> |
| 39 <script>test();</script> |
| 40 </body> |
| 41 </html> |
OLD | NEW |