3 <script src=
"../../../resources/js-test.js"></script>
4 <style id=
"s1">span { color: red}
</style>
5 <style id=
"s2">span { color: red}
</style>
9 .class { width:
200px }
18 description("Test that adding a class then synchronously adding a style sheet produces correct styles. See also crbug.com/346873");
20 var target
= document
.getElementById("target");
23 // Set the class, which should schedule an async style recalc to change width to 200px.
24 target
.className
= 'class';
26 var styleElement
= document
.createElement("style");
27 styleElement
.textContent
= '#useless {width: 300px}';
28 // Insert before style sheet s2 in order to trigger style resolver reconstruction.
29 document
.getElementById('s2').insertBefore(styleElement
, null);
31 shouldBe("getComputedStyle(target).width", '"200px"');