Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/cssom/caretRangeFromPoint-replace-document.tentative.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8" />
<title>document.caretRangeFromPoint()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
const textarea = document.createElement("textarea");
document.replaceChild(textarea, document.documentElement);
let range = document.caretRangeFromPoint(0, 0);
assert_true(range instanceof Range);
assert_equals(range.startOffset, 1);
assert_equals(range.endOffset, 1);
assert_equals(range.startContainer, textarea);
assert_equals(range.endContainer, textarea);
}, "document.caretRangeFromPoint(0, 0)");
</script>