blob: 19e76b72a51607900d74a7e0d07c352f7622a3ec [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
#before::before, #after::after { content: attr(my-value); }
</style>
<div id="before">
<div></div>
<div>
<div></div>
</div>
</div>
<div id="after">
<div></div>
<div>
<div></div>
</div>
</div>
<script>
description("No subtree recalc when changing attribute used in generated content.");
document.body.offsetTop; // force layout
// Setting attribute neither used in attribute selectors nor content should not
// cause a recalc.
before.setAttribute("attr-unused", "unused");
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "0");
document.body.offsetTop; // force layout
before.setAttribute("my-value", "before");
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
document.body.offsetTop; // force layout
after.setAttribute("my-value", "after");
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
</script>