CaretPosition

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The CaretPosition interface represents the caret position, an indicator for the text insertion point. You can get a CaretPosition using the Document.caretPositionFromPoint() method.

Instance properties

This interface doesn't inherit any properties.

CaretPosition.offsetNode Read only Experimental

Returns a Node containing the found node at the caret's position.

CaretPosition.offset Read only Experimental

Returns a long representing the character offset in the caret position node.

Instance methods

CaretPosition.getClientRect Experimental

Returns the client rectangle for the caret range.

Specifications

Specification
CSSOM View Module
# caret-position

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
CaretPosition
Experimental
getClientRect
Experimental
offset
Experimental
offsetNode
Experimental

See also