Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
body { margin: 0; }
#box { width: 100px; height: 100px; background: rgb(0, 0, 255); }
#box:hover { background: rgb(0, 128, 0); }
iframe { width: 100px; height: 50px; border: 0; }
</style>
<div id="box"></div>
<iframe srcdoc="<p>An iframe the same event loop renders</p>"></iframe>
<script>
// A rendering update that renders an iframe beside the document leaves the document a lane that hovers.
asyncTest(async done => {
await new Promise(resolve => document.querySelector("iframe").addEventListener("load", resolve, { once: true }));
const presentedBy = await whileLaneHovers(() => {
internals.injectHoverPointer(50, 50);
return internals.lastFramePresentedBy(document);
});
println(`last frame presented by: ${presentedBy}`);
await nextFrame();
println(`box matches :hover: ${box.matches(":hover")}`);
println(`box background: ${getComputedStyle(box).backgroundColor}`);
done();
});
</script>