-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
50 lines (34 loc) · 1.15 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: "Document: caretRangeFromPoint() method"
short-title: caretRangeFromPoint()
slug: Web/API/Document/caretRangeFromPoint
page-type: web-api-instance-method
status:
- non-standard
browser-compat: api.Document.caretRangeFromPoint
---
{{APIRef("DOM")}}{{Non-standard_header}}
The **`caretRangeFromPoint()`** method of the
{{domxref("Document")}} interface returns a {{domxref("Range")}} object for the document
fragment under the specified coordinates.
This method is the WebKit-proprietary implementation of the {{domxref("Document.caretPositionFromPoint")}} method.
## Syntax
```js-nolint
caretRangeFromPoint(x, y)
```
### Parameters
- `x`
- : A horizontal position within the current viewport.
- `y`
- : A vertical position within the current viewport.
### Return value
One of the following:
- A {{domxref("Range")}}.
- `Null`, if _x_ or _y_ are negative, outside viewport,
or there is no text entry node.
## Examples
Visit the {{domxref("Document.caretPositionFromPoint#Examples", "Document.caretPositionFromPoint")}} page to view a live sample of this method.
## Specifications
Not part of any specification.
## Browser compatibility
{{Compat}}