2 <script src=
"../../../resources/js-test.js"></script>
4 :-webkit-any(.a1) { background-color: green }
5 .a2 :-webkit-any(.b2) { background-color: green }
6 .a3 :-webkit-any(.b3, .c3) { background-color: green }
7 .a4 :-webkit-any(:not(.b4), .c4) { background-color: green }
8 :-webkit-any(.a5, .b5) ~ .c5 .d5 { background-color: green }
21 <span class=
"b2"></span>
26 <span class=
"b3"></span>
27 <span class=
"c3"></span>
31 <span class=
"b4"></span>
32 <span class=
"b4"></span>
33 <span class=
"c4"></span>
38 <span class=
"d5"></span>
42 description("Check that targeted class invalidation works with :-webkit-any selectors.");
44 var transparent
= "rgba(0, 0, 0, 0)";
45 var green
= "rgb(0, 128, 0)";
47 var t1
= document
.getElementById("t1");
48 var b2
= document
.querySelector("#t2 .b2");
49 var b3
= document
.querySelector("#t3 .b3");
50 var c3
= document
.querySelector("#t3 .c3");
51 var spans4
= document
.querySelectorAll("#t4 span");
52 var d5
= document
.querySelector("#t5 ~ .c5 .d5");
54 shouldBe("getComputedStyle(t1, null).backgroundColor", "transparent");
55 shouldBe("getComputedStyle(b2, null).backgroundColor", "transparent");
56 shouldBe("getComputedStyle(b3, null).backgroundColor", "transparent");
57 shouldBe("getComputedStyle(c3, null).backgroundColor", "transparent");
59 for (var i
=0; i
<4; i
++)
60 shouldBe("getComputedStyle(spans4[i], null).backgroundColor", "transparent");
62 shouldBe("getComputedStyle(d5, null).backgroundColor", "transparent");
64 document
.body
.offsetLeft
; // force style recalc.
68 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
69 shouldBe("getComputedStyle(t1, null).backgroundColor", "green");
71 document
.body
.offsetLeft
; // force style recalc.
73 document
.getElementById("t2").className
= "a2";
75 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
76 shouldBe("getComputedStyle(b2, null).backgroundColor", "green");
78 document
.body
.offsetLeft
; // force style recalc.
80 document
.getElementById("t3").className
= "a3";
82 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
83 shouldBe("getComputedStyle(b3, null).backgroundColor", "green");
84 shouldBe("getComputedStyle(c3, null).backgroundColor", "green");
86 document
.body
.offsetLeft
; // force style recalc.
88 document
.getElementById("t4").className
= "a4";
90 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "5");
91 shouldBe("getComputedStyle(spans4[0], null).backgroundColor", "green");
92 shouldBe("getComputedStyle(spans4[1], null).backgroundColor", "transparent");
93 shouldBe("getComputedStyle(spans4[2], null).backgroundColor", "transparent");
94 shouldBe("getComputedStyle(spans4[3], null).backgroundColor", "green");
96 document
.body
.offsetLeft
; // force style recalc.
98 document
.getElementById("t5").className
= "a5";
100 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3");
101 shouldBe("getComputedStyle(d5, null).backgroundColor", "green");