blob: 3fb26f92291622bde1f5d03e5589c1ae8293d2f7 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
#sibling, #child { background-color: green }
custom-one:unresolved #child, custom-two:unresolved + #sibling { background-color: red }
</style>
<custom-one>
<div></div>
<div id="child"></div>
</custom-one>
<custom-two>
<div></div>
<div></div>
</custom-two>
<div id="sibling"></div>
<script>
description("Use invalidation sets for :unresolved pseudo class.")
var red = "rgb(255, 0, 0)";
var green = "rgb(0, 128, 0)";
// Initially :unresolved.
shouldBe("getComputedStyle(child).backgroundColor", "red");
shouldBe("getComputedStyle(sibling).backgroundColor", "red");
document.body.offsetTop; // force recalc
var CustomOne = document.registerElement("custom-one", { prototype: Object.create(HTMLElement.prototype) });
document.head.appendChild(new CustomOne());
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
shouldBe("getComputedStyle(child).backgroundColor", "green");
document.body.offsetTop; // force recalc
var CustomTwo = document.registerElement("custom-two", { prototype: Object.create(HTMLElement.prototype) });
document.head.appendChild(new CustomTwo());
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
shouldBe("getComputedStyle(sibling).backgroundColor", "green");
</script>