Home

# Class goog.dom.ControlRange

Create a new control selection 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_()` Clear cached values.
| `clone() ⇒ ?goog.dom.ControlRange`
| `collapse(boolean toAnchor)` Collapses the range to one of its boundary points.
| `getBrowserRangeObject() ⇒ (Range|TextRange|null)`
| `getContainer() ⇒ ?Node`
| `getElements() ⇒ ?Array`
| `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.
| `getSortedElements() ⇒ ?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.
| `replaceContentsWithNode(?Node node) ⇒ ?Node` Replaces 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.
| `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
| `createFromBrowserRange(?Object controlRange) ⇒ ?goog.dom.ControlRange` Create a new range wrapper from the given browser range object. Do not use this method directly - please use goog.dom.Range.createFrom* instead.
| `createFromElements((Element|null|undefined) var_args) ⇒ ?goog.dom.ControlRange` Create a new range wrapper that selects the given element. Do not use this method directly - please use goog.dom.Range.createFrom* instead.