OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 <link rel=import id=redImport href="./resources/style-red.html"> |
| 7 <link rel=import id=blueImport href="./resources/style-blue.html"> |
| 8 <link rel=import id=redImportDup href="./resources/style-red.html"> |
| 9 </head> |
| 10 <body> |
| 11 <h1 class="target">Should be red</h1> |
| 12 <h1 class="another-red-target">Should be red</h1> |
| 13 <script> |
| 14 var t = async_test('Styles are re-applied in correct ordder after removed import
s are re-added in new place'); |
| 15 window.onload = function() { |
| 16 t.step(function() { |
| 17 var firstLink = document.querySelector('#redImport') |
| 18 var dupLink = document.querySelector('#redImportDup'); |
| 19 document.head.removeChild(dupLink); |
| 20 assert_equals(window.getComputedStyle(document.querySelector('.target'))
.color, 'rgb(0, 0, 255)', 'Removal reveals shadowed style.'); |
| 21 assert_equals(window.getComputedStyle(document.querySelector('.another-r
ed-target')).color, 'rgb(255, 0, 0)', 'But sheet is still there.'); |
| 22 |
| 23 document.head.removeChild(firstLink); |
| 24 document.head.appendChild(dupLink); |
| 25 assert_equals(window.getComputedStyle(document.querySelector('.target'))
.color, 'rgb(255, 0, 0)', 'Used-to-be-a-dup sheet is applied now.'); |
| 26 assert_equals(window.getComputedStyle(document.querySelector('.another-r
ed-target')).color, 'rgb(255, 0, 0)', 'That means this should be applied as well
.'); |
| 27 |
| 28 Array.prototype.forEach.call(document.querySelectorAll("h1"), function(e
) { e.style.display = "none"; }); |
| 29 t.done(); |
| 30 }); |
| 31 } |
| 32 </script> |
| 33 </body> |
| 34 </html> |
OLD | NEW |