Home

# Class goog.dom.MultiRange

Creates a new multi part range with no properties. Do not use this constructor: use one of the goog.dom.Range.createFrom* methods instead.

extends goog.dom.AbstractMultiRange

Instance Method Summary
| `__iterator__(boolean= opt_keys) ⇒ ?goog.dom.RangeIterator` Returns a RangeIterator over the contents of the range. Regardless of the direction of the range, the iterator will move in document order.
| `clearCachedValues_()` Clears cached values. Should be called whenever this.browserRanges_ is modified.
| `clone() ⇒ ?goog.dom.MultiRange`
| `collapse(boolean toAnchor)` Collapses this range to a single point, either the first or last point depending on the parameter. This will result in the number of ranges in this multi range becoming 1.
| `getBrowserRangeObject() ⇒ (Range|TextRange|null)`
| `getContainer() ⇒ ?Node`
| `getEndNode() ⇒ ?Node`
| `getEndOffset() ⇒ number`
| `getHtmlFragment() ⇒ string` Returns 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() ⇒ string` Returns 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.
| `getSortedRanges() ⇒ ?Array`
| `getStartNode() ⇒ ?Node`
| `getStartOffset() ⇒ number`
| `getText() ⇒ string`
| `getTextRange(number i) ⇒ ?goog.dom.TextRange` Get 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() ⇒ string` Returns valid HTML for this range. This is fast on IE, and semi-fast on other browsers.
| `isCollapsed() ⇒ boolean`
| `isRangeInDocument() ⇒ boolean` Tests 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.
| `removeContents()` Removes the contents of the range from the document.
| `saveUsingDom() ⇒ ?goog.dom.SavedRange` Saves 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) ⇒ boolean` Sets the native browser range object, overwriting any state this range was storing.

Static Method Summary
| `createFromBrowserRanges(?Array browserRanges) ⇒ ?goog.dom.MultiRange` Creates a new range wrapper from the given browser ranges. Do not use this method directly - please use goog.dom.Range.createFrom* instead.
| `createFromBrowserSelection(?Selection selection) ⇒ ?goog.dom.MultiRange` Creates a new range wrapper from the given browser selection object. Do not use this method directly - please use goog.dom.Range.createFrom* instead.
| `createFromTextRanges(?Array textRanges) ⇒ ?goog.dom.MultiRange` Creates a new range wrapper from the given goog.dom.TextRange objects. Do not use this method directly - please use goog.dom.Range.createFrom* instead.