style: Fix sheet invalidation in quirks mode documents.

Bug: 1433589
This commit is contained in:
Emilio Cobos Álvarez 2018-01-27 18:59:06 +01:00
parent faa969a91d
commit 125f275b5a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 51 additions and 11 deletions

View file

@ -0,0 +1,27 @@
<!-- Quirks mode -->
<meta charset="utf-8">
<title>Invalidation of style due to a dynamic stylesheet change in quirks mode</title>
<link rel="help" href="https://html.spec.whatwg.org/#case-sensitivity-of-selectors">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1433589">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#foo {
width: 100px;
height: 100px;
background: red;
}
</style>
Should see a green square below.
<div id="foo"></div>
<script>
test(function() {
let foo = document.getElementById('foo');
assert_equals(getComputedStyle(foo).backgroundColor, "rgb(255, 0, 0)");
let style = document.createElement('style');
style.textContent = "#FoO { background: green; }";
document.body.appendChild(style);
assert_equals(getComputedStyle(foo).backgroundColor, "rgb(0, 128, 0)");
}, "Style should've changed to a green background");
</script>