Range.endContainer

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.

Range.endContainer 是一个只读属性。它会返回Range对象结束的Node。如果要改变一个节点结束的位置,使用方法Range.setEnd()或者相似的方法。

语法

endRangeNode = range.endContainer;

示例

js
var range = document.createRange();

range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);
endRangeNode = range.endContainer;

规范

Specification
DOM Standard
# ref-for-dom-range-endcontainer①

浏览器兼容性

BCD tables only load in the browser

参见