2 <script src=
"../../../resources/js-test.js"></script>
4 .t1 #host1::shadow .match { background-color: green; }
5 .t2 /deep/ .match { background-color: green; }
12 <div id=
"host2"></div>
16 description("Check that targeted class invalidation works for ::shadow and /deep/ combinators.");
18 // Create shadow trees
20 var host1
= document
.getElementById("host1");
21 var match1
= host1
.createShadowRoot().appendChild(document
.createElement("div"));
22 match1
.className
= "match";
24 var host2
= document
.getElementById("host2");
25 var innerHost
= host2
.createShadowRoot().appendChild(document
.createElement("div"));
26 var match2
= innerHost
.createShadowRoot().appendChild(document
.createElement("div"));
27 match2
.className
= "match";
29 var transparent
= "rgba(0, 0, 0, 0)";
30 var green
= "rgb(0, 128, 0)";
32 shouldBe("getComputedStyle(match1, null).backgroundColor", "transparent");
33 shouldBe("getComputedStyle(match2, null).backgroundColor", "transparent");
35 document
.body
.offsetLeft
; // force style recalc.
37 document
.getElementById("t1").className
= "t1";
39 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
40 shouldBe("getComputedStyle(match1, null).backgroundColor", "green");
42 document
.body
.offsetLeft
; // force style recalc.
44 document
.getElementById("t2").className
= "t2";
46 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
47 shouldBe("getComputedStyle(match2, null).backgroundColor", "green");