| <script src="../resources/js-test-pre.js"></script> |
| <p>This test requires testRunner and window.internals.</p> |
| <div id="test" class="styled"></div> |
| window.testElement = document.getElementById("test"); |
| shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'"); |
| shouldBe("testElement.offsetWidth", "0"); |
| // The author style above should override this user style. |
| internals.insertUserCSS("body .styled { background-color: green; width: 100px; }"); |
| shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'"); |
| shouldBe("testElement.offsetWidth", "0"); |
| // Since this style is more specific, it should override the original author style above. |
| internals.insertAuthorCSS("body .styled { background-color: green; width: 100px; }"); |
| shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'"); |
| shouldBe("testElement.offsetWidth", "100"); |