Creates a new selection with no properties. Do not use this constructor - use one of the goog.dom.Range.from* methods instead.
| Instance Method Summary | |
__iterator__(boolean= opt_keys) ⇒ ?goog.dom.RangeIteratorReturns a RangeIterator over the contents of the range. Regardless of the direction of the range, the iterator will move in document order. | |
clone() ⇒ ?goog.dom.AbstractRange | |
collapse(boolean toAnchor)Collapses the range to one of its boundary points. | |
containsNode(?Node node, boolean= opt_allowPartial) ⇒ booleanTests if this range contains the given node. | |
containsRange(?goog.dom.AbstractRange range, boolean= opt_allowPartial) ⇒ booleanTests if this range contains the given range. | |
getAnchorNode() ⇒ ?Node | |
getAnchorOffset() ⇒ number | |
getBrowserRangeObject() ⇒ (Range|TextRange|null) | |
getContainer() ⇒ ?Node | |
getContainerElement() ⇒ ?ElementReturns the deepest element in the tree that contains the entire range. | |
getDocument() ⇒ ?Document | |
getEndNode() ⇒ ?Node | |
getEndOffset() ⇒ number | |
getFocusNode() ⇒ ?Node | |
getFocusOffset() ⇒ 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 | |
getTextRanges() ⇒ ?ArrayGets an array of all text ranges this range is comprised of. For non-multi ranges, returns a single element array containing this. | |
getType() ⇒ ?goog.dom.RangeType | |
getValidHtml() ⇒ stringReturns valid HTML for this range. This is fast on IE, and semi-fast on other browsers. | |
getWindow() ⇒ ?Window | |
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 | |
removeContents()Removes the contents of the range from the document. | |
replaceContentsWithNode(?Node node) ⇒ ?NodeReplaces the range contents with (possibly a copy of) the given node. The range may be disrupted beyond recovery because of the way this splits nodes. | |
saveUsingCarets() ⇒ ?goog.dom.SavedCaretRangeSaves the range using HTML carets. As long as the carets remained in the HTML, the range can be restored...even when the HTML is copied across documents. | |
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. | |
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 | |
getBrowserSelectionForWindow(?Window win) ⇒ ?ObjectGets the browser native selection object from the given window. | |
isNativeControlRange(?Object range) ⇒ booleanTests if the given Object is a controlRange. | |