Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    #target { transition: opacity 100s linear, display 100s allow-discrete; opacity: 1; }
    #target.hidden { display: none; opacity: 0; }
</style>
<div id="target"><span id="child">x</span></div>
<script>
    test(() => {
        const target = document.getElementById("target");
        const measure = (label, mutation) => {
            internals.updateStyle();
            mutation();
            internals.updateStyle();
            const animations = target.getAnimations().map(animation => animation.transitionProperty).sort().join(",");
            println(`${label}: display ${getComputedStyle(target).display}, transitions ${animations}`);
        };
        target.firstChild.remove();
        // The class change moves display beside a value a transition runs on: the display
        // transition keeps the element displayed, and both transitions start.
        measure("hidden", () => target.classList.add("hidden"));
        measure("shown", () => target.classList.remove("hidden"));
    });
</script>