JavaScript Selection and Range

# basics
`window.getSelection` and `document.getSelection` all returns the `Selection` object, the selection object is almost useless.

`window.getSelection.getRangeAt(0)` returns a Range object. for history reasons, there is only one range in each selection.

`rangeAncestor = range.commonAncestorContainer;` commonAncestorContainer is the common ancestor of the range elements.

及时获取更新,请关注公众号“爬虫技术学习(spider-learn)”

公众号“爬虫技术学习(spider-learn)”

About 逸飞

后端工程师

发表评论

电子邮件地址不会被公开。 必填项已用*标注