OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style>#t1 { color: red }</style> |
| 5 <div id="t1">Should be green.</div> |
| 6 <script> |
| 7 test(() => { |
| 8 // Triggers synch active stylesheet update. |
| 9 var sheet = document.styleSheets[0]; |
| 10 // Clears the previous RuleSet for rebuild. |
| 11 sheet.insertRule("#dummy {}", 0); |
| 12 // No Ruleset recreated since media does not match. |
| 13 sheet.media.mediaText = "nomatch"; |
| 14 var newStyle = document.createElement("style"); |
| 15 newStyle.appendChild(document.createTextNode("div { color: green }")); |
| 16 // New sheet triggers active stylesheet update and style recalc for #t1. |
| 17 document.head.appendChild(newStyle); |
| 18 }, "Check that appending a stylesheet while clearing the RuleSet of an exist
ing sheet does not crash"); |
| 19 |
| 20 test(() => assert_equals(getComputedStyle(t1).color, "rgb(0, 128, 0)"), |
| 21 "Check that the #t1 rule no longer applies."); |
| 22 </script> |
OLD | NEW |