lynx   »   [go: up one dir, main page]

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

CaretPosition

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

CaretPosition 接口表示光标位置,即文本插入点的指示器。你可以使用 Document.caretPositionFromPoint() 方法获取 CaretPosition

实例属性

该接口不继承任何属性。

CaretPosition.offsetNode 只读

返回一个包含光标位置节点的 Node

CaretPosition.offset 只读

返回一个 long,表示光标位置在节点中的字符偏移量。这将是文本节点中的字符偏移量,或元素节点中选定子节点的索引。

实例方法

CaretPosition.getClientRect 实验性

返回光标范围的客户端矩形。

规范

Specification
CSSOM View Module
# caret-position

浏览器兼容性

参见

Лучший частный хостинг