Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
    body { margin: 0; }
    a { display: block; width: 200px; height: 40px; color: rgb(0, 0, 255); transition: color 100s linear; }
    a:hover { color: rgb(255, 0, 0); }
    svg { width: 20px; height: 20px; }
</style>
<a id="link" href="#"><svg viewBox="0 0 10 10"><path id="icon" d="M0 0h10v10H0z" fill="currentColor"/></svg> Link</a>
<script>
    // A hover whose style change starts a transition of the color an SVG icon inherits is the main thread's to finish,
    // as no tick shows a sample in the icon's boxes: the icon would show the after-change color meanwhile.
    asyncTest(async done => {
        const presentedBy = await whileLaneHovers(() => {
            internals.injectHoverPointer(150, 20);
            return internals.lastFramePresentedBy(document);
        });
        println(`a tick presented the last frame: ${presentedBy === "clock"}`);
        await nextFrame();
        println(`link matches :hover: ${link.matches(":hover")}`);
        println(`transitions: ${link.getAnimations().length}`);
        done();
    });
</script>