Range.setStartBefore()

翻译正在进行中。

Range.setStartBefore() 方法相对另一个 Node来设置一个Range 的开始位置. Range的开始节点(focusNode)的父节点,和  referenceNode的父节点是同一个.

Syntax

range.setStartBefore(referenceNode);

Parameters

referenceNode
一个Range新的开始位置上的Node.

Example

var range = document.createRange();
var referenceNode = document.getElementsByTagName("div").item(0);

range.setStartBefore(referenceNode);

Specifications

Specification Status Comment
DOM
Range.setStartBefore()
Living Standard No change.
Document Object Model (DOM) Level 2 Traversal and Range Specification
Range.setStartBefore()
Obsolete Initial specification.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
setStartBeforeChrome Full support YesEdge Full support 12Firefox Full support 4IE Full support 9Opera Full support 9Safari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

文档标签和贡献者

此页面的贡献者: loszer
最后编辑者: loszer,