OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 #sibling, #child { background-color: green } |
| 5 custom-one:unresolved #child, custom-two:unresolved + #sibling { background-colo
r: red } |
| 6 </style> |
| 7 |
| 8 <custom-one> |
| 9 <div></div> |
| 10 <div id="child"></div> |
| 11 </custom-one> |
| 12 |
| 13 <custom-two> |
| 14 <div></div> |
| 15 <div></div> |
| 16 </custom-two> |
| 17 <div id="sibling"></div> |
| 18 |
| 19 <script> |
| 20 description("Use invalidation sets for :unresolved pseudo class.") |
| 21 |
| 22 var red = "rgb(255, 0, 0)"; |
| 23 var green = "rgb(0, 128, 0)"; |
| 24 |
| 25 // Initially :unresolved. |
| 26 shouldBe("getComputedStyle(child).backgroundColor", "red"); |
| 27 shouldBe("getComputedStyle(sibling).backgroundColor", "red"); |
| 28 |
| 29 document.body.offsetTop; // force recalc |
| 30 |
| 31 var CustomOne = document.registerElement("custom-one", { prototype: Object.creat
e(HTMLElement.prototype) }); |
| 32 document.head.appendChild(new CustomOne()); |
| 33 |
| 34 if (window.internals) |
| 35 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 36 shouldBe("getComputedStyle(child).backgroundColor", "green"); |
| 37 |
| 38 document.body.offsetTop; // force recalc |
| 39 |
| 40 var CustomTwo = document.registerElement("custom-two", { prototype: Object.creat
e(HTMLElement.prototype) }); |
| 41 document.head.appendChild(new CustomTwo()); |
| 42 |
| 43 if (window.internals) |
| 44 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 45 shouldBe("getComputedStyle(sibling).backgroundColor", "green"); |
| 46 |
| 47 </script> |
OLD | NEW |