This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

setEndBefore

Summary

Sets the end of the range to a point before a specific node.

Method of dom/Rangedom/Range

Syntax

var result = range.setEndBefore(/* see parameter list */);

Parameters

referenceNode

Data-type
DOM Node

A node in the document hierarchy.

Return Value

Returns an object of type NumberNumber

Type: HRESULT

This method can return one of these values.

Return codeDescription
S_OKThe operation completed successfully.
InvalidStateErrordetach has been invoked on the object.

Examples

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

range.setEndBefore(referenceNode);

Syntax

range.setEndBefore(referenceNode);

Standards information

Related specifications

DOM
Living Standard

Attributions