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 </body> | |
7 <script> | |
8 function computedBackgroundColor(elem) { | |
9 return document.defaultView.getComputedStyle(elem, '').backgroundColor; | |
10 } | |
11 | |
12 async_test((test) => { | |
13 let link = document.createElement('link'); | |
14 link.setAttribute('rel', 'stylesheet'); | |
15 link.setAttribute('href', 'resources/test.css'); | |
16 link.addEventListener("load", (e) => { | |
17 test.step(() => { | |
18 assert_equals(computedBackgroundColor(host), 'rgba(0, 0, 0, 0)', 'A host i n a document tree should not be styled.'); | |
kochi
2016/07/26 05:35:06
Having a :host rule in linked css and check if tha
hayato
2016/07/26 06:04:32
That sounds another concern. That should not be do
| |
19 assert_equals(computedBackgroundColor(shadowChild), 'rgb(0, 0, 255)', 'An element in a shadow tree should be styled.'); | |
20 test.done(); | |
21 }); | |
22 }); | |
23 let sr = host.attachShadow({ mode: 'open' }); | |
24 let shadowChild = document.createElement('div'); | |
25 sr.appendChild(shadowChild); | |
26 sr.appendChild(link); | |
27 }, '<link rel=stylesheet> should load a stylesheet in a connected shadow tree.') ; | |
28 </script> | |
OLD | NEW |