Skip to content

Truly independent web browser

816 B
Raw Blame
<!DOCTYPE html>
<script src="include.js"></script>
<div id="container" style="container-type: size; width: 300px; height: 100px">
    <div id="wrapper" style="width: 100px">
        <svg id="svg" width="100%" height="100"><text id="label" x="50cqw" y="50">Label</text></svg>
    </div>
</div>
<script>
    function labelOffset() {
        return Math.round(label.getBoundingClientRect().left - svg.getBoundingClientRect().left);
    }

    asyncTest(async done => {
        await animationFrame();
        await animationFrame();
        println(`After load, in a 300px container: x ${labelOffset()}`);
        container.style.width = "400px";
        await animationFrame();
        await animationFrame();
        println(`After the container grew to 400px: x ${labelOffset()}`);
        done();
    });
</script>