OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <body> |
| 5 <div id="host"></div> |
| 6 <div id="bodyChild"></div> |
| 7 </body> |
| 8 <script> |
| 9 function colorFor(elem) { |
| 10 return document.defaultView.getComputedStyle(elem, '').color; |
| 11 } |
| 12 |
| 13 async_test((test) => { |
| 14 let link = document.createElement('link'); |
| 15 link.setAttribute('rel', 'stylesheet'); |
| 16 link.setAttribute('href', 'data:text/css,div { color: green }'); |
| 17 link.addEventListener("load", test.step_func_done(() => { |
| 18 assert_equals(colorFor(bodyChild), 'rgb(0, 0, 0)', 'An element in a docume
nt tree should not be styled.'); |
| 19 assert_equals(colorFor(shadowChild), 'rgb(0, 128, 0)', 'An element in a sh
adow tree should be styled.'); |
| 20 })); |
| 21 let sr = host.attachShadow({ mode: 'open' }); |
| 22 let shadowChild = document.createElement('div'); |
| 23 sr.appendChild(shadowChild); |
| 24 sr.appendChild(link); |
| 25 }, '<link rel=stylesheet> should load a stylesheet in a connected shadow tree.')
; |
| 26 </script> |
OLD | NEW |