Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
body { margin: 0; }
#target { cursor: pointer; width: 100px; height: 100px; }
</style>
<div id="target"></div>
<script>
// A style a rendering update applies changes the `cursor` of what is under the pointer at rest. The hover follows
// once the update's frame landed, and shows the cursor the style gives. The output is printed at the end, so that no
// text of it lies under the pointer meanwhile.
asyncTest(async done => {
await whileLaneHovers(async frameTime => {
internals.mouseMove(50, 50);
let time = frameTime;
const lines = [];
const step = async change => {
change();
time += 16;
internals.injectRenderingOpportunity(time);
await untilLaneSettled();
await nextTask();
};
lines.push(`cursor over the target: ${internals.currentCursor()}`);
await step(() => target.style.cursor = "none");
lines.push(`cursor once the frame with the style landed: ${internals.currentCursor()}`);
await step(() => target.style.cursor = "help");
lines.push(`cursor once the frame with the next style landed: ${internals.currentCursor()}`);
println(lines.join("\n"));
});
done();
});
</script>