Skip to content

Truly independent web browser

831 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style id="definitions">@function --size() { result: 10px; }</style>
<style>
    #target { width: --size(); height: 1px; }
    #target::before { content: ""; display: inline-block; width: --size(); }
</style>
<div id="target"></div>
<script>
    // An element and its ::before call a custom function whose body changes. Check both take the
    // new result.
    test(() => {
        internals.updateStyle();
        const sheet = document.getElementById("definitions").sheet;
        sheet.deleteRule(0);
        sheet.insertRule("@function --size() { result: 20px; }");
        internals.updateStyle();
        println(`element width: ${getComputedStyle(target).width}`);
        println(`::before width: ${getComputedStyle(target, "::before").width}`);
    });
</script>