OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <style> | 3 <style> |
4 .host1 /deep/ div { color: green } | 4 .host1 /deep/ div { color: green } |
5 #host2 /deep/ div { color: red !important } | 5 #host2 /deep/ div { color: red !important } |
6 </style> | 6 </style> |
7 <div id="v1host"></div> | 7 <div id="v1host"></div> |
8 <div id="host1" class="host1"></div> | 8 <div id="host1" class="host1"></div> |
9 <div id="host2" class="host2"></div> | 9 <div id="host2" class="host2"></div> |
10 <script> | 10 <script> |
11 description("Cascade order for inner/outer tree rules with /deep/."); | 11 description("Cascade order for inner/outer tree rules with /deep/."); |
12 | 12 |
13 // Trigger "V1" cascading order. | 13 // Trigger "V1" cascading order. |
14 v1host.attachShadow({'mode': 'open'}); | 14 v1host.attachShadow({'mode': 'open'}); |
15 | 15 |
16 // /deep/ rules only apply to V0 shadow root. | 16 // /deep/ rules only apply to V0 shadow root. |
17 var root1 = host1.createShadowRoot(); | 17 var root1 = host1.createShadowRoot(); |
18 root1.innerHTML = '<style>#d1 {color:red}</style><div id="d1">Should be gree
n</div><div style="color: red">Should be green</div>'; | 18 root1.innerHTML = '<style>#d1 {color:red}</style><div id="d1">Should be gree
n</div><div style="color: red">Should be green</div>'; |
19 | 19 |
20 var root2 = host2.createShadowRoot(); | 20 var root2 = host2.createShadowRoot(); |
21 root2.innerHTML = '<style>.d1 {color:green !important}</style><div class="d1
">Should be green</div><div style="color: green !important">Should be green</div
>'; | 21 root2.innerHTML = '<style>.d1 {color:green !important}</style><div class="d1
">Should be green</div><div style="color: green !important">Should be green</div
>'; |
22 | 22 |
23 var green = 'rgb(0, 128, 0)'; | 23 var green = 'rgb(0, 128, 0)'; |
24 var red = 'rgb(255, 0, 0)'; | 24 var red = 'rgb(255, 0, 0)'; |
25 | 25 |
26 shouldBe('getComputedStyle(root1.querySelector("div")).color', 'green'); | 26 shouldBe('getComputedStyle(root1.querySelector("div")).color', 'green'); |
27 shouldBe('getComputedStyle(root1.querySelector("div + div")).color', 'green'
); | 27 shouldBe('getComputedStyle(root1.querySelector("div + div")).color', 'green'
); |
28 shouldBe('getComputedStyle(root2.querySelector("div")).color', 'green'); | 28 shouldBe('getComputedStyle(root2.querySelector("div")).color', 'green'); |
29 shouldBe('getComputedStyle(root2.querySelector("div + div")).color', 'green'
); | 29 shouldBe('getComputedStyle(root2.querySelector("div + div")).color', 'green'
); |
30 </script> | 30 </script> |
OLD | NEW |