Skip to content

Truly independent web browser

1.3 KB
Raw Blame
<!doctype html>
<html class="reftest-wait">
    <style>
        body {
            margin: 0;
        }

        #container {
            display: flex;
            gap: 4px;
        }

        .target {
            width: 100px;
            height: 50px;
            background: url("../data/red-then-green.gif") no-repeat;
        }
    </style>
    <div id="container">
        <div class="target"></div>
    </div>
    <script src="../../Text/input/include.js"></script>
    <script>
        (async () => {
            const imageURL = "../data/red-then-green.gif";

            // Wait for the animation to start.
            await waitForImageAnimationState(imageURL, state => state.isAnimating);

            // Wait for half of the first frame's duration
            await timeout(250);

            // Add a new consumer. It's frame timings should be aligned with the first consumer.
            const lateTarget = document.createElement("div");
            lateTarget.className = "target";
            container.append(lateTarget);

            // Wait for the animation to advance to the second frame. Both consumers should be showing the second frame
            await waitForImageAnimationState(imageURL, state => state.shownFrameIndex > 0);

            document.documentElement.classList.remove("reftest-wait");
        })();
    </script>
</html>