Skip to content

Truly independent web browser

1.0 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    #ex { font-size: 3ex; }
    #target::before { content: "a"; }
    #target::after { content: "b"; font-family: monospace; }
</style>
<div id="ex"></div>
<script>
    test(() => {
        // The element's pseudo-elements settle beside its own record, which substitutes a
        // container unit and so stays out of every record cache. ::before settles first;
        // ::after's monospace recascade then waits for the monospace font under the ex-sized
        // ancestor. The retry resumes the settlement instead of refusing it.
        internals.updateStyle();
        const target = document.createElement("span");
        target.id = "target";
        target.style.cssText = "--width: 10cqw; width: var(--width)";
        document.getElementById("ex").appendChild(target);
        internals.updateStyle();
        println(`before: ${getComputedStyle(target, "::before").content}`);
        println(`after: ${getComputedStyle(target, "::after").fontFamily}`);
    });
</script>