| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <style>.green { color: green }</style> |
| <div id="host"> |
| <div id="inner">Green, should not crash.</div> |
| </div> |
| <script> |
| var root = host.createShadowRoot(); |
| |
| test(() => { |
| root.innerHTML = "<style>:host ::content * { color:red }</style><content>"; |
| document.body.offsetTop; |
| assert_equals(getComputedStyle(inner).color, "rgb(255, 0, 0)", "#inner is initially red."); |
| }, "Check that #inner is initially red."); |
| |
| test(() => { |
| // Inserting a document stylesheet before another one causes a |
| // StyleResolver Reconstruct. |
| var newSheet = document.createElement("style"); |
| newSheet.innerText = "#nomatch { color: red }"; |
| document.head.insertBefore(newSheet, document.querySelector("style")); |
| // Removing the shadow stylesheet will cause the ScopedStyleResolver |
| // to be nuked. |
| root.innerHTML = "<content>"; |
| inner.className = "green"; |
| assert_equals(getComputedStyle(inner).color, "rgb(0, 128, 0)", "Check that #inner is green after the class is set."); |
| }, "Reconstructing StyleResolver should not leave any treeBoundaryCrossingScopes with null ScopedStyleResolvers in StyleEngine."); |
| </script> |