Skip to content

Truly independent web browser

839 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    #hidden { display: none; color: red; }
</style>
<div id="hidden">
    <div id="child"><span id="grandchild">hidden text</span></div>
</div>
<script>
test(() => {
    internals.updateStyle();

    // A CSSOM read materializes the styles of a hidden subtree.
    println(`hidden grandchild color: ${getComputedStyle(grandchild).color}`);
    println(`after read:\n${internals.dumpStyleRecords(hidden).trimEnd()}`);

    // A moved inherited value of the hidden root clears the subtree's styles rather than computing them again.
    hidden.style.color = "green";
    internals.updateStyle();
    println(`after move:\n${internals.dumpStyleRecords(hidden).trimEnd()}`);
    println(`hidden grandchild color after move: ${getComputedStyle(grandchild).color}`);
});
</script>