<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<pre style="font: 10px/10px Ahem">foo

bar</pre>
<script>
test(() => {
const pre = document.querySelector('pre');
const text = pre.firstChild;
const x = pre.offsetLeft + 15;
const y = pre.offsetTop + 15;
const result = document.caretRangeFromPoint(x, y);
assert_true(result instanceof Range);
assert_equals(result.startContainer, text);
assert_equals(result.startOffset, 4); // "foo
|
bar"
assert_true(result.collapsed);
},
'Hit test the empty line in <pre>');
</script>