| 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 <script src="resources/shadow-dom.js"></script> | 3 <script src="resources/shadow-dom.js"></script> |
| 4 <style> | 4 <style> |
| 5 div { | 5 div { |
| 6 background-color: white; | 6 background-color: white; |
| 7 } | 7 } |
| 8 | 8 |
| 9 div#shadow-host:focus { | 9 div#shadow-host:focus { |
| 10 background-color: green; | 10 background-color: green; |
| 11 } | 11 } |
| 12 </style> | 12 </style> |
| 13 <body> | 13 <body> |
| 14 <div id="sandbox"></div> | 14 <div id="sandbox"></div> |
| 15 </body> | 15 </body> |
| 16 <script> | 16 <script> |
| 17 function buildShadowComposedTree(delegatesFocus1, delegatesFocus2) { | 17 function buildShadowComposedTree(delegatesFocus1, delegatesFocus2) { |
| 18 var sandbox = document.querySelector('#sandbox'); | 18 var sandbox = document.querySelector('#sandbox'); |
| 19 sandbox.innerHTML = ''; | 19 sandbox.innerHTML = ''; |
| 20 sandbox.appendChild( | 20 sandbox.appendChild( |
| 21 createDOM('div', {}, | 21 createDOM('div', {}, |
| 22 createDOM('input', {'id': 'outer-input'}), | 22 createDOM('input', {'id': 'outer-input'}), |
| 23 createDOM('div', {'id': 'shadow-host'}, | 23 createDOM('div', {'id': 'shadow-host'}, |
| 24 createShadowRoot( | 24 attachShadow( |
| 25 {'delegatesFocus': delegatesFocus1}, | 25 {'mode': 'open', 'delegatesFocus': delegatesFocus1}, |
| 26 createDOM('style', {}, | 26 createDOM('style', {}, |
| 27 document.createTextNode('div { background-color: yellow;
} div#inner-shadow-host:focus { background-color: blue; }')), | 27 document.createTextNode('div { background-color: yellow;
} div#inner-shadow-host:focus { background-color: blue; }')), |
| 28 createDOM('div', {'id': 'inner-div'}, | 28 createDOM('div', {'id': 'inner-div'}, |
| 29 document.createTextNode('Blink')), | 29 document.createTextNode('Blink')), |
| 30 createDOM('input', {'id': 'inner-input'}), | 30 createDOM('input', {'id': 'inner-input'}), |
| 31 createDOM('div', {'id': 'inner-shadow-host'}, | 31 createDOM('div', {'id': 'inner-shadow-host'}, |
| 32 createShadowRoot( | 32 attachShadow( |
| 33 {'delegatesFocus': delegatesFocus2}, | 33 {'mode': 'open', 'delegatesFocus': delegatesFocus2}, |
| 34 createDOM('div', {'id': 'inner-div2'}, | 34 createDOM('div', {'id': 'inner-div2'}, |
| 35 document.createTextNode('Blink')), | 35 document.createTextNode('Blink')), |
| 36 createDOM('input', {'id': 'inner-input2'}))))))); | 36 createDOM('input', {'id': 'inner-input2'}))))))); |
| 37 sandbox.offsetTop; | 37 sandbox.offsetTop; |
| 38 } | 38 } |
| 39 | 39 |
| 40 function testShadowComposedTree() { | 40 function testShadowComposedTree() { |
| 41 debug('testing shadow composed tree'); | 41 debug('testing shadow composed tree'); |
| 42 | 42 |
| 43 debug('(1/4) both shadow hosts\' delegateFocus are false'); | 43 debug('(1/4) both shadow hosts\' delegateFocus are false'); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 host.focus(); | 142 host.focus(); |
| 143 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 143 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 144 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(255, 255, 0)')
; | 144 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(255, 255, 0)')
; |
| 145 innerHost.focus(); | 145 innerHost.focus(); |
| 146 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 146 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 147 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(0, 0, 255)'); | 147 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(0, 0, 255)'); |
| 148 } | 148 } |
| 149 | 149 |
| 150 testShadowComposedTree(); | 150 testShadowComposedTree(); |
| 151 </script> | 151 </script> |
| OLD | NEW |