Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
@font-face {
font-family: Ahem;
src: url("../../../Ref/data/fonts/Ahem.ttf");
}
body {
margin: 0;
}
#container {
width: 50px;
font: 10px/20px Ahem;
/* Center alignment gives the two line pieces different left edges, so the
event offset origin (the first piece) is distinguishable from the union. */
text-align: center;
}
</style>
<div id="container"><a id="link" href="#">aa aaaa</a></div>
<script>
promiseTest(async () => {
await document.fonts.ready;
await animationFrame();
const link = document.getElementById("link");
const rects = link.getClientRects();
println(`rects: ${rects.length}`);
const r1 = rects[rects.length - 1];
const x = r1.left + 15;
const y = (r1.top + r1.bottom) / 2;
link.addEventListener("click", (event) => {
println(`offsetX: ${event.offsetX}`);
println(`offsetY: ${event.offsetY}`);
});
internals.click(x, y);
});
</script>