Skip to content

Truly independent web browser

939 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    #declarer { --size: 20px; }
    #unrelated { --other: 5px; }
    #unrelated.wide { --other: 10px; }
</style>
<div id="declarer"></div>
<div id="unrelated"><span id="child"></span></div>
<script>
    // A registration that inherits leaves the custom-property environment of an element declaring
    // only names nothing registers to the style engine.
    test(() => {
        CSS.registerProperty({ name: "--size", syntax: "<length>", inherits: true, initialValue: "0px" });
        internals.updateStyle();

        document.getElementById("unrelated").classList.add("wide");
        internals.updateStyle();

        println(`inherited value: ${getComputedStyle(document.getElementById("child")).getPropertyValue("--other")}`);
        println(`registered value: ${getComputedStyle(document.getElementById("declarer")).getPropertyValue("--size")}`);
    });
</script>