OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="resources/shadow-dom.js"></script> | 4 <script src="resources/shadow-dom.js"></script> |
5 <script src="../../../resources/js-test.js"></script> | 5 <script src="../../../resources/js-test.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div id='sandbox'></div> | 8 <div id='sandbox'></div> |
9 <pre id='console'></pre> | 9 <pre id='console'></pre> |
10 </body> | 10 </body> |
(...skipping 18 matching lines...) Expand all Loading... |
29 shouldNotBe(text, unevaledString); | 29 shouldNotBe(text, unevaledString); |
30 } | 30 } |
31 | 31 |
32 function cleanUp() | 32 function cleanUp() |
33 { | 33 { |
34 document.getElementById('sandbox').innerHTML = ''; | 34 document.getElementById('sandbox').innerHTML = ''; |
35 } | 35 } |
36 | 36 |
37 description('Test for casacde of treeboundary crossing rules.'); | 37 description('Test for casacde of treeboundary crossing rules.'); |
38 | 38 |
39 // Rules declared in inner treescope should win. | 39 // Rules declared in outer treescope should win. |
40 sandbox.appendChild( | 40 sandbox.appendChild( |
41 createDOM('div', {'id': 'host'}, | 41 createDOM('div', {'id': 'host'}, |
42 createDOM('style', {}, | 42 createDOM('style', {}, |
43 document.createTextNode('p:empty { border: 1px solid blue; }')), | 43 document.createTextNode('p:empty { border: 1px solid green; }')), |
44 createShadowRoot( | 44 createShadowRoot( |
45 createDOM('style', {}, | 45 createDOM('style', {}, |
46 document.createTextNode('::content > p { border: 1px solid red;
}')), | 46 document.createTextNode('::content > p { border: 1px solid red;
}')), |
47 createDOM('div', {}, | 47 createDOM('div', {}, |
48 createShadowRoot( | 48 createShadowRoot( |
49 createDOM('style', {}, | 49 createDOM('style', {}, |
50 document.createTextNode('::content > p { border: 1px sol
id green; }')), | 50 document.createTextNode('::content > p { border: 1px sol
id blue; }')), |
51 createDOM('content', {})), | 51 createDOM('content', {})), |
52 createDOM('content', {}))), | 52 createDOM('content', {}))), |
53 createDOM('p', {'id': 'target'}))); | 53 createDOM('p', {'id': 'target'}))); |
54 | 54 |
55 borderColorShouldBe('target', 'rgb(0, 128, 0)'); | 55 borderColorShouldBe('target', 'rgb(0, 128, 0)'); |
56 | 56 |
57 cleanUp(); | 57 cleanUp(); |
58 | 58 |
59 // Rules declared in outer treescope should win. | 59 // Rules declared in outer treescope should win. |
60 sandbox.appendChild( | 60 sandbox.appendChild( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 createDOM('style', {}, | 96 createDOM('style', {}, |
97 document.createTextNode('content::content >
p { border: 1px solid yellow; }')), | 97 document.createTextNode('content::content >
p { border: 1px solid yellow; }')), |
98 createDOM('content', {})), | 98 createDOM('content', {})), |
99 createDOM('content', {}))), | 99 createDOM('content', {}))), |
100 createDOM('p', {'id': 'target'})))))); | 100 createDOM('p', {'id': 'target'})))))); |
101 | 101 |
102 borderColorShouldBe('host/target', 'rgb(0, 128, 0)'); | 102 borderColorShouldBe('host/target', 'rgb(0, 128, 0)'); |
103 | 103 |
104 cleanUp(); | 104 cleanUp(); |
105 | 105 |
| 106 // Comparing important rules declared in outer treescope with important rules de
clared in inner treescope. |
| 107 // Inner's should win. |
| 108 sandbox.appendChild( |
| 109 createDOM('div', {}, |
| 110 createDOM('style', {}, |
| 111 document.createTextNode('div { border: 1px solid red !important; }')
), |
| 112 createDOM('div', {'id': 'host'}, |
| 113 createShadowRoot( |
| 114 createDOM('style', {}, |
| 115 document.createTextNode('#target { border: 1px solid green !
important; }')), |
| 116 createDOM('p', {'id': 'target'}))))); |
| 117 |
| 118 borderColorShouldBe('host/target', 'rgb(0, 128, 0)'); |
| 119 |
| 120 cleanUp(); |
| 121 |
106 </script> | 122 </script> |
107 </html> | 123 </html> |
108 | 124 |
OLD | NEW |