Range

Availability

BlackBerry Device Software version 4.7.1 or later

The Range object represents a range of content between two boundary points, a start point and an end point, in a Document , DocumentFragment , or Attr node.

You can create a Range object by using Document.createRange() . You can retrieve a Range object by using Selection.getRangeAt() .

Properties

Property name

Type

Description

Status

Support level

Availability

collapsed

boolean

Returns true if the start point and end point of the range are the same.

read-only

DOM 2 Range

4.7.1+

commonAncestor Container

Node

Returns the deepest node that contains the startContainer and endContainer nodes.

read-only

DOM 2 Range

4.7.1+

endContainer

Node

Returns the node that contains the end point of the range.

read-only

DOM 2 Range

4.7.1+

endOffset

int

Returns a number that represents the end point of the range within the endContainer node.

read-only

DOM 2 Range

4.7.1+

startContainer

Node

Returns the node that contains the start point of the range.

read-only

DOM 2 Range

4.7.1+

startOffset

int

Returns a number that represents the start point of the range within the startContainer node.

read-only

DOM 2 Range

4.7.1+

Methods

Method name

Description

Support level

Availability

cloneContents()

Duplicates the contents of a specified range.

DOM 2 Range

4.7.1+

cloneRange()

Creates a new Range object with the same start point and end point as the specified range.

DOM 2 Range

4.7.1+

collapse()

Collapses a range onto its start point or end point.

DOM 2 Range

4.7.1+

compareBoundaryPoints()

Compares the start points and end points of two ranges.

DOM 2 Range

4.7.1+

deleteContents()

Deletes the contents of the range from the Document or DocumentFragment node.

DOM 2 Range

4.7.1+

detach()

Immediately releases the Range object from the object model.

DOM 2 Range

4.7.1+

extractContents()

Extracts the entire contents of the range from a Document or DocumentFragment node and moves it to a new DocumentFragment object.

DOM 2 Range

4.7.1+

insertNode()

Inserts a new node at the start of the range.

DOM 2 Range

4.7.1+

selectNode()

Populates the range with a specified node and its contents.

DOM 2 Range

4.7.1+

selectNodeContents()

Populates the range with the contents of a specified node.

DOM 2 Range

4.7.1+

setEnd()

Sets the end point of the range.

DOM 2 Range

4.7.1+

setEndAfter()

Sets the end point of a range at a position that is after the specified node.

DOM 2 Range

4.7.1+

setEndBefore()

Sets the end point of a range at a position that is before the specified node.

DOM 2 Range

4.7.1+

setStart()

Sets the start point of the range.

DOM 2 Range

4.7.1+

setStartAfter()

Sets the start point of a range at a position that is after the specified node.

DOM 2 Range

4.7.1+

setStartBefore()

Sets the start point of a range at a position that is before the specified node.

DOM 2 Range

4.7.1+

surroundContents()

Moves the contents of the range to a new node object, and inserts the new node at the start point of the range.

DOM 2 Range

4.7.1+

toString()

Returns the contents of the range as a string.

DOM 2 Range

4.7.1+

Last modified: 2014-03-10



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus