| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../js/resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <!-- crbug.com/246300 --> |
| 8 <!-- #host shadow root --> |
| 9 <template id="t"> |
| 10 <style> |
| 11 #host { |
| 12 height: 50px; |
| 13 width: 50px; |
| 14 background: lightgray; |
| 15 } |
| 16 </style> |
| 17 <div id="container"></div> |
| 18 </template> |
| 19 |
| 20 <!-- #container shadow root --> |
| 21 <template id="t2"> |
| 22 <style> |
| 23 div { |
| 24 background: black; |
| 25 height: 40px; |
| 26 width: 40px; |
| 27 } |
| 28 #green { |
| 29 background: green; |
| 30 } |
| 31 </style> |
| 32 <div id="green"></div> |
| 33 </template> |
| 34 |
| 35 <div id="host"></div> |
| 36 </body> |
| 37 <script> |
| 38 description('Test for Issue: 246300: Styles in nested shadows are not recalculat
ed correctly on insertion.'); |
| 39 |
| 40 var backgroundColor; |
| 41 |
| 42 function shouldHaveBackgroundColor(element, bg) |
| 43 { |
| 44 backgroundColor = window.getComputedStyle(element).backgroundColor; |
| 45 shouldBeEqualToString("backgroundColor", bg); |
| 46 } |
| 47 |
| 48 var sr = host.webkitCreateShadowRoot(); |
| 49 sr.appendChild(t.content.cloneNode(true)); |
| 50 var container = sr.querySelector('#container'); |
| 51 var sr2 = container.webkitCreateShadowRoot(); |
| 52 sr2.appendChild(t2.content.cloneNode(true)); |
| 53 |
| 54 jsTestIsAsync = true; |
| 55 setTimeout(function() { |
| 56 container.remove(); |
| 57 sr.appendChild(container); |
| 58 |
| 59 shouldHaveBackgroundColor(sr2.getElementById('green'), 'rgb(0, 128, 0)'); |
| 60 finishJSTest(); |
| 61 }, 0); |
| 62 </script> |
| 63 <script src="../../js/resources/js-test-post.js"></script> |
| 64 </html> |
| OLD | NEW |