Selection.anchorOffset

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

只读属性,返回选区的锚节点( Selection.anchorNode)起点偏移量的数字。返回值从零开始计数,如果选区从锚节点(Selection.anchorNode)的第一个字符开始,返回值为 0。

语法

number = sel.anchorOffset

规范

Specification
Selection API
# dom-selection-anchoroffset

浏览器兼容性

BCD tables only load in the browser

相关内容