Skip to content

Truly independent web browser

870 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<div id="container"></div>
<script>
    function makeFont(color) {
        const font = document.createElement("font");
        font.setAttribute("color", color);
        font.textContent = "text";
        return font;
    }

    function measure(label, color) {
        container.replaceChildren(makeFont("red"));
        internals.updateStyle();

        const font = makeFont(color);
        container.append(font);
        internals.updateStyle();

        println(`${label}: color ${getComputedStyle(font).color}`);
    }

    // The engine computes a font element's first record, and a sibling alike in everything the
    // record is computed from takes the record its donor got.
    test(() => {
        measure("differing sibling", "blue");
        measure("identical sibling", "red");
    });
</script>