Methods
This section describes the methods associated with the Document Object Model (DOM) Traversal API.
In this section
| Topic | Description |
|---|---|
|
Returns a document fragment containing the nodes of a range. If any nodes are partially selected, their start or end nodes are included. | |
|
Returns a new range with boundary points that are equal to the original range. | |
|
Collapses (or removes) a range by moving the insertion point to the beginning or end of the current range. | |
|
Compares two ranges by comparing their boundary points. | |
|
Compares an end point of a TextRange object with an end point of another range. | |
|
The createContextualFragment() method enables you to parse a string of HTML into a DocumentFragment using the starting node of a DOM Range as the parsing context. | |
|
Creates a controlRange collection of nontext elements. | |
|
Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. | |
|
Returns an empty range object that has both of its boundary points positioned at the beginning of the document. | |
|
Creates a TextRange object from the current text selection, or a controlRange collection from a control selection. | |
|
Creates a TextRange object collection from the current selection. | |
|
Creates a TextRange object for the element. | |
|
Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. | |
|
Removes all contents within a selected range. | |
|
Removes or detaches an object and associated resources. | |
|
Returns a duplicate of the TextRange. | |
|
Displays help information for the given command identifier. | |
|
Expands the range so that partial units are completely contained. | |
|
Removes the contents of a range from a document or document fragment and puts it a new document fragment. | |
|
Searches for text in the document and positions the start and end points of the range to encompass the search string. | |
|
Retrieves a reference to the first child of the current node of the filtered TreeWalker hierarchy and updates currentNode. | |
|
Retrieves a bookmark (opaque string) that can be used with moveToBookmark to return to the same range. | |
|
Returns a value indicating whether one range is contained within another. | |
|
Inserts a node into the start of a Range object. | |
|
Returns a value indicating whether the specified range is equal to the current range. | |
|
Retrieves an object from a TextRange collection. | |
|
Retrieves an object from a controlRange collection. | |
|
Retrieves a reference to the last child of the current node of the filtered TreeWalker hierarchy and updates currentNode. | |
|
Collapses the given text range and moves the empty range by the given number of units. | |
|
Changes the end position of the range. | |
|
Changes the start position of the range. | |
|
Moves to a bookmark. | |
|
Moves the text range so that the start and end positions of the range encompass the text in the given element. | |
|
Moves the start and end positions of the text range to the given point. | |
|
Returns the next node in the NodeIterator or TreeWalker list and updates currentNode. | |
|
Retrieves the next sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode. | |
|
Retrieves the parent element for the given text range. | |
|
Retrieves the parent object in the document hierarchy relative to the current node and updates currentNode. | |
|
Pastes HTML text into the given text range, replacing any previous text and HTML elements in the range. | |
|
Returns the previous node in the NodeIterator or TreeWalker list and updates currentNode. | |
|
Retrieves the previous sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode. | |
|
Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. | |
|
Returns a Boolean value that indicates whether the specified command is in the indeterminate state. | |
|
Returns a Boolean value that indicates the current state of the command. | |
|
Returns a Boolean value that indicates whether the current command is supported on the current range. | |
|
Retrieves the string associated with a command. | |
|
Returns the current value of the document, range, or current selection for the given command. | |
|
Causes the object to scroll into view, aligning it either at the top or bottom of the window. | |
|
Makes the selection equal to the current object. | |
|
Selects a range node and all of its contents. | |
|
Selects the contents within a node in a range. | |
|
Sets the end point of the range. | |
|
Sets the end of a range to a point after a specific node. | |
|
Sets the end of the range to a point before a specific node. | |
|
Sets the endpoint of one range based on the endpoint of another range. | |
|
Sets the starting point of a range. | |
|
Sets the starting point of the range to a point after a specific node. | |
|
Sets the start point of a range to a point before a specific node. | |
|
Moves the contents of a Range to a new parent node, placing the new parent node at the start position of the Range. | |
|
Returns the contents of a Range as a string. This string contains only the data characters, no markup. |