OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <script src="resources/shadow-dom.js"></script> | |
5 <script src="../../../resources/js-test.js"></script> | |
6 </head> | |
7 <body class="bodyClass"> | |
8 <div id="sandbox"></div> | |
9 <pre id="console"></pre> | |
10 </body> | |
11 <script> | |
12 description("Test for ::content with ::shadow and :host."); | |
13 | |
14 var sandbox = document.getElementById('sandbox'); | |
15 | |
16 function cleanUp() | |
17 { | |
18 sandbox.innerHTML = ''; | |
19 } | |
20 | |
21 sandbox.appendChild( | |
22 createDOM('div', {'id': 'host1'}, | |
23 createShadowRoot( | |
24 createDOM('style', {}, | |
25 document.createTextNode( | |
26 ':host(#host1)::shadow #content1::content > .content { color
: green; }')), | |
27 createDOM('div', {}, | |
28 createDOM('div', {'id': 'host2'}, | |
29 createShadowRoot( | |
30 createDOM('content', {'id': 'content2'})), | |
31 createDOM('div', {'id': 'parentOfContent1'}, | |
32 createDOM('content', {'id': 'content1'}))))), | |
33 createDOM('div', {'class': 'content'}, | |
34 document.createTextNode('content')))); | |
35 | |
36 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
37 | |
38 cleanUp(); | |
39 | |
40 sandbox.appendChild( | |
41 createDOM('div', {'id': 'host1'}, | |
42 createShadowRoot( | |
43 createDOM('style', {}, | |
44 document.createTextNode( | |
45 '#host2::shadow #content2::content > #parentOfContent1 > #co
ntent1::content > .content { color: green; }')), | |
46 createDOM('div', {}, | |
47 createDOM('div', {'id': 'host2'}, | |
48 createShadowRoot( | |
49 createDOM('content', {'id': 'content2'})), | |
50 createDOM('div', {'id': 'parentOfContent1'}, | |
51 createDOM('content', {'id': 'content1'}))))), | |
52 createDOM('div', {'class': 'content'}, | |
53 document.createTextNode('content')))); | |
54 | |
55 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
56 | |
57 cleanUp(); | |
58 | |
59 sandbox.appendChild( | |
60 createDOM('div', {'id': 'host1'}, | |
61 createShadowRoot( | |
62 createDOM('style', {}, | |
63 document.createTextNode( | |
64 ':host::shadow #content2::content > #shadow1::content > #con
tent1::content > .content { color: red; }')), | |
65 createDOM('content', {'id': 'content1'})), | |
66 createShadowRoot( | |
67 createDOM('div', {}, | |
68 createDOM('div', {'id': 'host2'}, | |
69 createShadowRoot( | |
70 createDOM('content', {'id': 'content2'})), | |
71 createDOM('div', {'id': 'parentOfShadow1'}, | |
72 createDOM('shadow', {'id': 'shadow1'}))))), | |
73 createDOM('div', {'class': 'content'}, | |
74 document.createTextNode('content')))); | |
75 | |
76 shouldNotBe('window.getComputedStyle(document.querySelector("#host1 > .content")
).color', '"rgb(255, 0, 0)"'); | |
77 | |
78 cleanUp(); | |
79 | |
80 sandbox.appendChild( | |
81 createDOM('div', {'id': 'host1'}, | |
82 createShadowRoot( | |
83 createDOM('style', {}, | |
84 document.createTextNode( | |
85 ':host::shadow #content2::content > #parentOfContent1 > #con
tent1::content > .content { color: red; }')), | |
86 createDOM('div', {}, | |
87 createDOM('div', {'id': 'host2'}, | |
88 createShadowRoot( | |
89 createDOM('content', {'id': 'content2'})), | |
90 createDOM('div', {'id': 'parentOfContent1'}, | |
91 createDOM('content', {'id': 'content1'}))))), | |
92 createDOM('div', {'class': 'content'}, | |
93 document.createTextNode('content')))); | |
94 | |
95 shouldNotBe('window.getComputedStyle(document.querySelector("#host1 > .content")
).color', '"rgb(255, 0, 0)"'); | |
96 | |
97 cleanUp(); | |
98 | |
99 </script> | |
100 </html> | |
OLD | NEW |