| <!DOCTYPE html> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <link rel="import" href="resources/bye.html"></link> |
| <style>.target { color: green }</style> |
| <link rel="import" href="resources/style-red.html"></link> |
| <div class="target">This text should be green.</div> |
| <script> |
| var importDoc = document.querySelectorAll("link")[0].import; |
| var newLink = importDoc.createElement("link"); |
| newLink.setAttribute("rel", "import"); |
| newLink.setAttribute("href", "style-red.html"); |
| var targetElement = document.querySelector(".target"); |
| |
| test(() => { |
| assert_equals(getComputedStyle(targetElement).color, "rgb(255, 0, 0)"); |
| }, ".target should initially be red"); |
| |
| importDoc.head.appendChild(newLink); |
| |
| test(() => { |
| assert_equals(getComputedStyle(targetElement).color, "rgb(0, 128, 0)"); |
| }, ".target should be green after style-red.html is inserted as an import child before the inline green style."); |
| </script> |