Platform Support
IE | Mozilla | Netscape | Opera | Safari | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
---|
Constructors
Constructor | Action | IE | Mozilla | Netscape | Opera | Safari | ||
---|---|---|---|---|---|---|---|---|
Range Constructor() : Range
Represents a range of nodes within a document.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||
Range() : RangeRepresents a range of nodes within a document. Returns
|
Properties
Property | Action | IE | Mozilla | Netscape | Opera | Safari |
---|---|---|---|---|---|---|
collapsed
: Boolean
If true, indicates that the range is collapsed.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
||||||
commonAncestorContainer
: Node
Deepest nested node in the document that contains both the start and end points of the range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
||||||
endContainer
: Node
Document node that contains the end point of the range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
||||||
endOffset
: Number
End position of the range in the endContainer.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
||||||
startContainer
: Node
Document node that contains the start point of the range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
||||||
startOffset
: Number
Position of the start point of the range in the startContainer.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ |
|
Functions
Method | Action | IE | Mozilla | Netscape | Opera | Safari | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
static cloneContents() : DocumentFragment
Creates a new DocumentFragment that contains a copy of the document contents for the specified Range.
|
Show Details | no | 1.0+ | 7.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
||||||||||||||
static cloneRange() : Range
Creates a copy of the specified Range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
||||||||||||||
collapse(Boolean toStart) : void
Collapses the Range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
compareBoundaryPoints(Number how, Range sourceRange) : Number
Compares the specified set of boundary points.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
deleteContents() : void
Deletes the contents of the document for the specified Range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
||||||||||||||
detach() : void
Stops the implementation of the range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
||||||||||||||
static extractContents() : DocumentFragment
Extracts, deletes, and returns the contents of the Range as a DocumentFragment.
|
Show Details | no | 1.0+ | 7.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
||||||||||||||
insertNode(Node newNode) : void
Inserts the specified node at the starting point for the Range.
|
Show Details | no | 1.0+ | 7.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
selectNode(Node refNode) : void
Sets the boundary points of the Range to contain the node and its descendants.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
selectNodeContents(Node refNode) : void
Sets the boundary points of the Range to contain the descendants of a node, but not the actual node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setEnd(Node refNode, Number offset) : void
Sets the end point of the Range as specified by node and offset.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setEndAfter(Node refNode) : void
Sets the end point of the range to immediately after the specified node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setEndBefore(Node refNode) : void
Sets the end point of the range to immediately before the specified node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setStart(Node refNode, Number offset) : void
Sets the start point of the range to the specified position within the specified node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setStartAfter(Node refNode) : void
Sets the start point of the range to immediately after the specified node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
setStartBefore(Node refNode) : void
Sets the start point of the range to immediately before the specified node.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
surroundContents(Node newParent) : void
Inserts the specified node and makes it a parent to the nodes in the Range.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Parameters
Returns
|
||||||||||||||
static toString() : String
Returns the document contents of the Range as a plain text string.
|
Show Details | no | 1.0+ | 6.0+ | 9.0+ | 1.0+ | ||||||||
Returns
|
References
Document.createRange|DocumentFragment
Availability
HTML DOM Level 2|W3C