blob: 5b90ae3f125f96604cd444a9761864de03a2702b [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
description("getBoundingClientRect() called on a &lt;br&gt; returns a zero-width and -height rect positioned at the end of the preceding line of text, on the baseline of the text.");
function runTest()
{
br = document.getElementById("br")
brRect = br.getBoundingClientRect();
brRects = br.getClientRects();
precedingSpanRect = br.previousSibling.getBoundingClientRect();
shouldBe("brRect.width", "0");
shouldBe("brRect.height", "0");
shouldBe("brRect.left", "precedingSpanRect.right");
shouldBeGreaterThan("brRect.top", "precedingSpanRect.top");
shouldBeGreaterThan("precedingSpanRect.bottom", "brRect.top");
shouldBe("brRects.length", "1");
shouldBe("brRects[0].left", "brRect.left");
shouldBe("brRects[0].top", "brRect.top");
shouldBe("brRects[0].width", "brRect.width");
shouldBe("brRects[0].height", "brRect.height");
}
window.onload = runTest;
</script>
</head>
<body>
<p>Filler text.</p>
<p><span>There's a line break element at the end of this sentence.</span><br id="br">
<span>Here is the second line.</span></p>
</body>
</html>