OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <link rel="import" href="resources/bye.html"></link> |
| 5 <style>.target { color: green }</style> |
| 6 <link rel="import" href="resources/style-red.html"></link> |
| 7 <div class="target">This text should be green.</div> |
| 8 <script> |
| 9 var importDoc = document.querySelectorAll("link")[0].import; |
| 10 var newLink = importDoc.createElement("link"); |
| 11 newLink.setAttribute("rel", "import"); |
| 12 newLink.setAttribute("href", "style-red.html"); |
| 13 var targetElement = document.querySelector(".target"); |
| 14 |
| 15 test(() => { |
| 16 assert_equals(getComputedStyle(targetElement).color, "rgb(255, 0, 0)"); |
| 17 }, ".target should initially be red"); |
| 18 |
| 19 importDoc.head.appendChild(newLink); |
| 20 |
| 21 test(() => { |
| 22 assert_equals(getComputedStyle(targetElement).color, "rgb(0, 128, 0)"); |
| 23 }, ".target should be green after style-red.html is inserted as an import ch
ild before the inline green style."); |
| 24 </script> |
OLD | NEW |