Skip to content

Truly independent web browser

742 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    #viewport { font-size: 5vw; }
    #calc { font-size: calc(10px + 1em); }
    #keyword { font-size: large; }
    code { font-family: monospace; }
</style>
<div id="viewport"><div id="keyword"><code id="under-viewport">a</code></div></div>
<div id="calc"><div><code id="under-calc">b</code></div></div>
<script>
    test(() => {
        // The monospace font-size recascade reads the viewport through its ancestors, and goes on
        // from the size a calc() computed to, which carries no keyword through.
        for (const id of ["under-viewport", "under-calc"])
            println(`${id}: ${getComputedStyle(document.getElementById(id)).fontSize}`);
    });
</script>