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;
font: 10px/10px Ahem;
}
input {
font: inherit;
margin: 0;
height: 30px;
}
</style>
<div><span>A</span><input type="range" /></div>
<div><span>A</span><input type="range" style="margin: 3px 0 5px" /></div>
<div><span>A</span><input type="range" style="border: 2px solid; padding: 3px" /></div>
<script>
// A range input's baseline is its bottom border edge, as in Chrome.
asyncTest(async done => {
await document.fonts.load("10px Ahem");
for (const input of document.querySelectorAll("input")) {
const text = input.previousElementSibling.getBoundingClientRect();
const box = input.getBoundingClientRect();
println(`text bottom relative to input: ${text.bottom - box.y}, input height: ${box.height}`);
}
done();
});
</script>