Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<svg id="svg">
    <rect id="kept" width="100" height="100" fill="red">
        <set id="set" attributeName="fill" to="green"/>
    </rect>
    <g id="group">
        <rect width="100" height="100" fill="red">
            <set attributeName="fill" to="green"/>
        </rect>
    </g>
</svg>
<script>
    asyncTest(async done => {
        const nextFrame = () => new Promise(requestAnimationFrame);
        await new Promise(resolve => window.addEventListener("load", resolve));
        await nextFrame();
        await nextFrame();
        println(`animated: ${getComputedStyle(kept).fill}`);

        // Remove an animated element with its running animation element, and an animation element from its target.
        document.getElementById("group").remove();
        document.getElementById("set").remove();
        await nextFrame();
        internals.gc();
        await nextFrame();
        await nextFrame();
        internals.gc();
        await nextFrame();
        println(`target without its animation element: ${getComputedStyle(kept).fill}`);
        done();
    });
</script>