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> | |
8 <div id='sandbox'> | |
9 <div id='target5' class='bar'>Should have blue background.</div> | |
10 </div> | |
11 <pre id='console'></pre> | |
12 </body> | |
13 <script> | |
14 var sandbox = document.getElementById('sandbox'); | |
15 sandbox.appendChild( | |
16 createDOM('div', {'id': 'host'}, | |
17 createShadowRoot( | |
18 createDOM('div', {'id': 'target1', 'class': 'foo'}, | |
19 document.createTextNode('Should have green background')), | |
20 createDOM('div', {'id': 'target2'}, | |
21 document.createTextNode('Should have green background')), | |
22 createDOM('div', {'id': 'target3', 'class': 'bar'}, | |
23 document.createTextNode('Should have blue background')), | |
24 createDOM('div', {'id': 'target4'}, | |
25 document.createTextNode('Should have blue background'))))); | |
26 document.body.offsetLeft; | |
27 | |
28 var style = document.createElement('style'); | |
29 style.innerHTML = 'div::shadow .foo { background: green; }' | |
30 + 'div::shadow #target2 { background: green; }' | |
31 + 'div /deep/ .bar { background: blue; }' | |
32 + 'div /deep/ #target4 { background: blue; }'; | |
33 document.body.appendChild(style); | |
34 | |
35 backgroundColorShouldBe('host/target1', 'rgb(0, 128, 0)'); | |
36 backgroundColorShouldBe('host/target2', 'rgb(0, 128, 0)'); | |
37 backgroundColorShouldBe('host/target3', 'rgb(0, 0, 255)'); | |
38 backgroundColorShouldBe('host/target4', 'rgb(0, 0, 255)'); | |
39 backgroundColorShouldBe('target5', 'rgb(0, 0, 255)'); | |
40 </script> | |
41 </html> | |
OLD | NEW |