OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <div id="host"> |
| 4 <div> |
| 5 <span></span> |
| 6 <span></span> |
| 7 </div> |
| 8 <div id="slotted"> |
| 9 <span></span> |
| 10 <span></span> |
| 11 </div> |
| 12 <div> |
| 13 <span></span> |
| 14 <span></span> |
| 15 </div> |
| 16 </host> |
| 17 <script> |
| 18 description("Style invalidation of slotted elements."); |
| 19 |
| 20 var root = host.attachShadow({"mode":"open"}); |
| 21 root.innerHTML = '<style>.outer ::slotted(#slotted) { background-color: red } .o
uter .inner::slotted(#slotted) { background-color: green }</style><div id="outer
"><slot id="inner"></slot></div>'; |
| 22 |
| 23 shouldBeEqualToString("getComputedStyle(slotted).backgroundColor", "rgba(0, 0, 0
, 0)"); |
| 24 |
| 25 host.offsetTop; // force recalc |
| 26 |
| 27 root.querySelector("#outer").className = "outer"; |
| 28 if (window.internals) |
| 29 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 30 shouldBeEqualToString("getComputedStyle(slotted).backgroundColor", "rgb(255, 0,
0)"); |
| 31 |
| 32 host.offsetTop; // force recalc |
| 33 |
| 34 root.querySelector("#inner").className = "inner"; |
| 35 if (window.internals) |
| 36 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 37 shouldBeEqualToString("getComputedStyle(slotted).backgroundColor", "rgb(0, 128,
0)"); |
| 38 </script> |
OLD | NEW |