Skip to content

Truly independent web browser

988 B
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
@font-face {
    font-family: Ahem;
    src: url("../../../Ref/data/fonts/Ahem.ttf");
}
body { margin: 0; font: 10px/20px Ahem; }
#rel { position: relative; }
#target { position: absolute; width: 10px; height: 10px; background: blue; }
</style>
<div id="rel"><span id="host" style="padding: 5px"><b id="target"></b></span></div>
<script>
promiseTest(async () => {
    await document.fonts.ready;
    await animationFrame();

    const target = document.getElementById("target");
    const rect = target.getBoundingClientRect();
    println(`target rect: ${Math.round(rect.x)},${Math.round(rect.y)} ${Math.round(rect.width)}x${Math.round(rect.height)}`);

    const hit = document.elementFromPoint(rect.x + 5, rect.y + 5);
    println(`elementFromPoint hits target: ${hit === target}`);

    const hostRects = document.getElementById("host").getClientRects();
    println(`host rect count: ${hostRects.length}`);
});
</script>