2 <script src=
"../../../resources/js-test.js"></script>
4 .a1 #b1 { background-color: green }
5 .a2 div + #b2 { background-color: green }
16 description("Check that targeted class invalidation works for id selectors.");
18 var transparent
= "rgba(0, 0, 0, 0)";
19 var green
= "rgb(0, 128, 0)";
21 var b1
= document
.getElementById("b1");
22 var b2
= document
.getElementById("b2");
24 shouldBe("getComputedStyle(b1, null).backgroundColor", "transparent");
25 shouldBe("getComputedStyle(b2, null).backgroundColor", "transparent");
27 document
.body
.offsetTop
; // Force style recalc.
29 document
.getElementById("t1").className
= "a1";
31 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
32 shouldBe("getComputedStyle(b1, null).backgroundColor", "green");
34 document
.body
.offsetLeft
; // force style recalc.
36 document
.getElementById("t2").className
= "a2";
38 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
39 shouldBe("getComputedStyle(b2, null).backgroundColor", "green");