Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Methods

This section describes the methods associated with the Document Object Model (DOM) Traversal API.

In this section

TopicDescription

cloneContents

Returns a document fragment containing the nodes of a range. If any nodes are partially selected, their start or end nodes are included.

cloneRange

Returns a new range with boundary points that are equal to the original range.

collapse

Collapses (or removes) a range by moving the insertion point to the beginning or end of the current range.

compareBoundaryPoints

Compares two ranges by comparing their boundary points.

compareEndPoints

Compares an end point of a TextRange object with an end point of another range.

createContextualFragment

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.

createControlRange

Creates a controlRange collection of nontext elements.

createNodeIterator

Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.

createRange

Returns an empty range object that has both of its boundary points positioned at the beginning of the document.

createRange (selection)

Creates a TextRange object from the current text selection, or a controlRange collection from a control selection.

createRangeCollection

Creates a TextRange object collection from the current selection.

createTextRange

Creates a TextRange object for the element.

createTreeWalker

Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.

deleteContents

Removes all contents within a selected range.

detach

Removes or detaches an object and associated resources.

duplicate

Returns a duplicate of the TextRange.

execCommandShowHelp

Displays help information for the given command identifier.

expand

Expands the range so that partial units are completely contained.

extractContents

Removes the contents of a range from a document or document fragment and puts it a new document fragment.

findText

Searches for text in the document and positions the start and end points of the range to encompass the search string.

firstChild

Retrieves a reference to the first child of the current node of the filtered TreeWalker hierarchy and updates currentNode.

getBookmark

Retrieves a bookmark (opaque string) that can be used with moveToBookmark to return to the same range.

inRange

Returns a value indicating whether one range is contained within another.

insertNode

Inserts a node into the start of a Range object.

isEqual

Returns a value indicating whether the specified range is equal to the current range.

item

Retrieves an object from a TextRange collection.

item

Retrieves an object from a controlRange collection.

lastChild

Retrieves a reference to the last child of the current node of the filtered TreeWalker hierarchy and updates currentNode.

move

Collapses the given text range and moves the empty range by the given number of units.

moveEnd

Changes the end position of the range.

moveStart

Changes the start position of the range.

moveToBookmark

Moves to a bookmark.

moveToElementText

Moves the text range so that the start and end positions of the range encompass the text in the given element.

moveToPoint

Moves the start and end positions of the text range to the given point.

nextNode

Returns the next node in the NodeIterator or TreeWalker list and updates currentNode.

nextSibling

Retrieves the next sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode.

parentElement

Retrieves the parent element for the given text range.

parentNode

Retrieves the parent object in the document hierarchy relative to the current node and updates currentNode.

pasteHTML

Pastes HTML text into the given text range, replacing any previous text and HTML elements in the range.

previousNode

Returns the previous node in the NodeIterator or TreeWalker list and updates currentNode.

previousSibling

Retrieves the previous sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode.

queryCommandEnabled

Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.

queryCommandIndeterm

Returns a Boolean value that indicates whether the specified command is in the indeterminate state.

queryCommandState

Returns a Boolean value that indicates the current state of the command.

queryCommandSupported

Returns a Boolean value that indicates whether the current command is supported on the current range.

queryCommandText

Retrieves the string associated with a command.

queryCommandValue

Returns the current value of the document, range, or current selection for the given command.

scrollIntoView

Causes the object to scroll into view, aligning it either at the top or bottom of the window.

select

Makes the selection equal to the current object.

selectNode

Selects a range node and all of its contents.

selectNodeContents

Selects the contents within a node in a range.

setEnd

Sets the end point of the range.

setEndAfter

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

setEndBefore

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

setEndPoint

Sets the endpoint of one range based on the endpoint of another range.

setStart

Sets the starting point of a range.

setStartAfter

Sets the starting point of the range to a point after a specific node.

setStartBefore

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

surroundContents

Moves the contents of a Range to a new parent node, placing the new parent node at the start position of the Range.

toString

Returns the contents of a Range as a string. This string contains only the data characters, no markup.

 

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.