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 |
4.7.1+ |
|
commonAncestor Container |
Returns the deepest node that contains the startContainer and endContainer nodes. |
read-only |
4.7.1+ |
||
endContainer |
Returns the node that contains the end point of the range. |
read-only |
4.7.1+ |
||
endOffset |
int |
Returns a number that represents the end point of the range within the endContainer node. |
read-only |
4.7.1+ |
|
startContainer |
Returns the node that contains the start point of the range. |
read-only |
4.7.1+ |
||
startOffset |
int |
Returns a number that represents the start point of the range within the startContainer node. |
read-only |
4.7.1+ |
Methods
Method name |
Description |
Support level |
Availability |
---|---|---|---|
cloneContents() |
Duplicates the contents of a specified range. |
4.7.1+ |
|
cloneRange() |
Creates a new Range object with the same start point and end point as the specified range. |
4.7.1+ |
|
collapse() |
Collapses a range onto its start point or end point. |
4.7.1+ |
|
compareBoundaryPoints() |
Compares the start points and end points of two ranges. |
4.7.1+ |
|
deleteContents() |
Deletes the contents of the range from the Document or DocumentFragment node. |
4.7.1+ |
|
detach() |
Immediately releases the Range object from the object model. |
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. |
4.7.1+ |
|
insertNode() |
Inserts a new node at the start of the range. |
4.7.1+ |
|
selectNode() |
Populates the range with a specified node and its contents. |
4.7.1+ |
|
selectNodeContents() |
Populates the range with the contents of a specified node. |
4.7.1+ |
|
setEnd() |
Sets the end point of the range. |
4.7.1+ |
|
setEndAfter() |
Sets the end point of a range at a position that is after the specified node. |
4.7.1+ |
|
setEndBefore() |
Sets the end point of a range at a position that is before the specified node. |
4.7.1+ |
|
setStart() |
Sets the start point of the range. |
4.7.1+ |
|
setStartAfter() |
Sets the start point of a range at a position that is after the specified node. |
4.7.1+ |
|
setStartBefore() |
Sets the start point of a range at a position that is before the specified node. |
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. |
4.7.1+ |
|
toString() |
Returns the contents of the range as a string. |
4.7.1+ |
Last modified: 2013-08-14