Skip to content

Truly independent web browser

1.4 KB
Raw Blame
<!doctype html>
<script src="../../include.js"></script>
<script src="../../work-test.js"></script>
<style>
    div {
        --rotation: rotate(var(--turn));
    }
    #inactive::marker {
        content: "marker";
        color: red;
    }
    #inactive::backdrop {
        color: red;
    }
    #ordinary {
        rotate: var(--turn);
    }
</style>
<div id="plain"></div>
<div id="inactive"></div>
<div id="ordinary"></div>
<script>
    test(() => {
        internals.updateStyle();
        CSS.registerProperty({ name: "--turn", syntax: "<angle>", inherits: false, initialValue: "0deg" });
        const results = [];
        for (const id of ["plain", "inactive", "ordinary"]) {
            const target = document.getElementById(id);
            const animation = target.animate({ "--turn": ["0deg", "360deg"], easing: "linear" }, 1000);
            animation.pause();
            animation.currentTime = 125;
            const work = styleWork(() => {
                for (const time of [375, 625, 125]) {
                    animation.currentTime = time;
                    internals.updateStyle();
                }
            });
            const rotation = getComputedStyle(target).getPropertyValue("--rotation");
            results.push(`${id}: restyled [${work.restyled().map(shortStyleName).join(", ")}], ${rotation}`);
        }
        results.forEach(println);
    });
</script>