blob: a5c9cbfe26571716d4ac9073a06fc802714f06fb [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<div id="target">hello</div>
<p id="description"></p>
<div id="console"></div>
<style>
html, body { margin: 0; padding: 0; }
body { margin: 10px; }
#target { font-size: 20px; line-height: 100%; }
</style>
<script src="../../../resources/js-test.js"></script>
<script>
description('This tests calling getBoundingClientRect on a selection range when it is collapsed.');
getSelection().setBaseAndExtent(target.lastChild, 0, target.lastChild, 0);
shouldBe('rect = getSelection().getRangeAt(0).getBoundingClientRect(); rect.x', '10');
shouldBe('rect.x', '10');
shouldBeTrue('rect.y > 5');
shouldBe('rect.width', '0');
shouldBeTrue('rect.height > 15');
successfullyParsed = true;
</script>
</body>
</html>