2 <script src=
"../../../resources/js-test.js"></script>
21 description("Check that targeted class invalidation works for ::content selectors.");
23 // Create shadow trees
25 host1
.createShadowRoot().innerHTML
= '<style>.c1::content #r1 { background-color: green }</style><content id="i1"></content>';
26 host2
.createShadowRoot().innerHTML
= '<style>.c2 ::content #r2 { background-color: green }</style><div id="i2"><div><content></content></div><div></div><div></div></div>';
27 host3
.createShadowRoot().innerHTML
= '<style>.c3::content * { background-color: green }</style><content id="i3"></content>';
29 var transparent
= "rgba(0, 0, 0, 0)";
30 var green
= "rgb(0, 128, 0)";
33 shouldBe("getComputedStyle(r1, null).backgroundColor", "transparent");
35 document
.body
.offsetTop
; // Force style recalc.
36 var i1
= host1
.shadowRoot
.getElementById("i1");
40 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "5");
42 shouldBe("getComputedStyle(r1, null).backgroundColor", "green");
44 shouldBe("getComputedStyle(r2, null).backgroundColor", "transparent");
46 document
.body
.offsetTop
; // Force style recalc.
47 var i2
= host2
.shadowRoot
.getElementById("i2");
51 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3");
53 shouldBe("getComputedStyle(r2, null).backgroundColor", "green");
55 shouldBe("getComputedStyle(r3, null).backgroundColor", "transparent");
57 document
.body
.offsetTop
; // Force style recalc.
58 var i3
= host3
.shadowRoot
.getElementById("i3");
62 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
64 shouldBe("getComputedStyle(r3, null).backgroundColor", "green");