Create a new text selection with no properties. Do not use this constructor: use one of the goog.dom.Range.createFrom* methods instead.
extends goog.dom.AbstractRange| Instance Method Summary | |
__iterator__(boolean= opt_keys) ⇒ ?goog.dom.TextRangeIteratorReturns a TextRangeIterator over the contents of the range. Regardless of the direction of the range, the iterator will move in document order. | |
clearCachedValues_()Clear all cached values. | |
clone() ⇒ ?goog.dom.TextRange | |
collapse(boolean toAnchor)Collapses the range to one of its boundary points. | |
containsRange(?goog.dom.AbstractRange range, boolean= opt_allowPartial) ⇒ booleanTests if this range contains the given range. | |
getBrowserRangeObject() ⇒ (Range|TextRange|null) | |
getBrowserRangeWrapper_() ⇒ ?goog.dom.browserrange.AbstractRange | |
getContainer() ⇒ ?Node | |
getEndNode() ⇒ ?Node | |
getEndOffset() ⇒ number | |
getHtmlFragment() ⇒ stringReturns the HTML fragment this range selects. This is slow on all browsers. The HTML fragment may not be valid HTML, for instance if the user selects from a to b inclusively in the following html: >div<a>/div<b This method will return a</div>b If you need valid HTML, use {@link #getValidHtml} instead. | |
getPastableHtml() ⇒ stringReturns pastable HTML for this range. This guarantees that any child items that must have specific ancestors will have them, for instance all TDs will be contained in a TR in a TBODY in a TABLE and all LIs will be contained in a UL or OL as appropriate. This is semi-fast on all browsers. | |
getStartNode() ⇒ ?Node | |
getStartOffset() ⇒ number | |
getText() ⇒ string | |
getTextRange(number i) ⇒ ?goog.dom.TextRangeGet the i-th text range in this range. The behavior is undefined if i >= getTextRangeCount or i < 0. | |
getTextRangeCount() ⇒ number | |
getType() ⇒ ?goog.dom.RangeType | |
getValidHtml() ⇒ stringReturns valid HTML for this range. This is fast on IE, and semi-fast on other browsers. | |
insertNode(?Node node, boolean before) ⇒ ?NodeInserts a node before (or after) the range. The range may be disrupted beyond recovery because of the way this splits nodes. | |
isCollapsed() ⇒ boolean | |
isRangeInDocument() ⇒ booleanTests whether this range is valid (i.e. whether its endpoints are still in the document). A range becomes invalid when, after this object was created, either one or both of its endpoints are removed from the document. Use of an invalid range can lead to runtime errors, particularly in IE. | |
isReversed() ⇒ boolean | |
moveToNodes(?Node startNode, number startOffset, ?Node endNode, number endOffset, boolean isReversed)Moves a TextRange to the provided nodes and offsets. | |
removeContents()Removes the contents of the range from the document. | |
saveUsingDom() ⇒ ?goog.dom.SavedRangeSaves the range so that if the start and end nodes are left alone, it can be restored. | |
select()Sets this range as the selection in its window. | |
setBrowserRangeObject((Range|TextRange|null) nativeRange) ⇒ booleanSets the native browser range object, overwriting any state this range was storing. | |
surroundContents(?Element element) ⇒ ?ElementSurrounds the text range with the specified element (on Mozilla) or with a clone of the specified element (on IE). Returns a reference to the surrounding element if the operation was successful; returns null if the operation failed. | |
surroundWithNodes(?Element startNode, ?Element endNode)Surrounds this range with the two given nodes. The range may be disrupted beyond recovery because of the way this splits nodes. | |
| Static Method Summary | |
createFromBrowserRange((Range|TextRange|null) range, boolean= opt_isReversed) ⇒ ?goog.dom.TextRangeCreate a new range wrapper from the given browser range object. Do not use this method directly - please use goog.dom.Range.createFrom* instead. | |
createFromBrowserRangeWrapper_(?goog.dom.browserrange.AbstractRange browserRange, boolean= opt_isReversed) ⇒ ?goog.dom.TextRangeCreate a new range wrapper from the given browser range wrapper. | |
createFromNodeContents(?Node node, boolean= opt_isReversed) ⇒ ?goog.dom.TextRangeCreate a new range wrapper that selects the given node's text. Do not use this method directly - please use goog.dom.Range.createFrom* instead. | |
createFromNodes(?Node anchorNode, number anchorOffset, ?Node focusNode, number focusOffset) ⇒ ?goog.dom.TextRangeCreate a new range wrapper that selects the area between the given nodes, accounting for the given offsets. Do not use this method directly - please use goog.dom.Range.createFrom* instead. | |
isAttachedNode(?Node node) ⇒ booleanTests if the given node is in a document. | |