OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src='../resources/testharness.js'></script> | 2 <script src='../resources/testharness.js'></script> |
3 <script src='../resources/testharnessreport.js'></script> | 3 <script src='../resources/testharnessreport.js'></script> |
4 <div id='host'></div> | 4 <div id='host'></div> |
5 <div id='dummy'></div> | 5 <div id='dummy'></div> |
6 <script> | 6 <script> |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 var root1 = host.createShadowRoot(); | 9 var root1 = host.createShadowRoot(); |
10 var root2 = host.createShadowRoot(); | 10 var root2 = host.createShadowRoot(); |
11 | 11 |
12 root1.innerHTML = '<style>:host { color: red; }</style>'; | 12 root1.innerHTML = '<style>:host { color: red; }</style>'; |
13 root2.innerHTML = '<style>:host { background-color: green; }</style>'; | 13 root2.innerHTML = '<style>:host { background-color: green; }</style>'; |
14 | 14 |
15 test(() => { | 15 test(() => { |
16 assert_equals(window.getComputedStyle(host).color, 'rgb(255, 0, 0)'); | 16 assert_equals(window.getComputedStyle(host).color, 'rgb(255, 0, 0)'); |
17 assert_equals(window.getComputedStyle(host).backgroundColor, 'rgb(0, 128, 0)')
; | 17 assert_equals(window.getComputedStyle(host).backgroundColor, 'rgb(0, 128, 0)')
; |
18 }, 'In case of multiple shadow, :host rules from all shadows should apply.'); | 18 }, 'In case of multiple shadow, :host rules from all shadows should apply.'); |
19 | 19 |
20 dummy.attachShadow({mode: 'open'}); | 20 dummy.attachShadow({mode: 'open'}); |
21 | 21 |
22 test(() => { | 22 test(() => { |
23 assert_equals(window.getComputedStyle(host).color, 'rgb(255, 0, 0)'); | 23 assert_equals(window.getComputedStyle(host).color, 'rgb(255, 0, 0)'); |
24 assert_equals(window.getComputedStyle(host).backgroundColor, 'rgb(0, 128, 0)')
; | 24 assert_equals(window.getComputedStyle(host).backgroundColor, 'rgb(0, 128, 0)')
; |
25 }, 'After V1 cascade rule is applied, :host rules from V0 multiple shadow should
apply.'); | 25 }, 'After V1 cascade rule is applied, :host rules from V0 multiple shadow should
apply.'); |
26 </script> | 26 </script> |
OLD | NEW |