Home

# Class goog.dom.SavedCaretRange

A struct for holding context about saved selections. This can be used to preserve the selection and restore while the DOM is manipulated, or through an asynchronous call. Use goog.dom.Range factory methods to obtain an {@see goog.dom.AbstractRange} instance, and use {@see goog.dom.AbstractRange#saveUsingCarets} to obtain a SavedCaretRange. For editor ranges under content-editable elements or design-mode iframes, prefer using {@see goog.editor.range.saveUsingNormalizedCarets}.

extends goog.dom.SavedRange

Instance Method Summary
| `createCaret_(boolean start) ⇒ ?Element` Creates a caret element.
| `disposeInternal()` Dispose the saved range and remove the carets from the DOM.
| `getCaret(boolean start) ⇒ ?Element` Gets carets.
| `removeCarets(?goog.dom.AbstractRange= opt_range) ⇒ (goog.dom.AbstractRange|null|undefined)` Removes the carets from the current restoration document.
| `restoreInternal() ⇒ ?goog.dom.AbstractRange` Reconstruct the selection from the given saved range. Removes carets after restoring the selection. If restore does not dispose this saved range, it may only be restored a second time if innerHTML or some other mechanism is used to restore the carets to the dom.
| `setRestorationDocument(!Document doc)` Sets the document where the range will be restored.
| `toAbstractRange() ⇒ ?goog.dom.AbstractRange` Gets the range that this SavedCaretRage represents, without selecting it or removing the carets from the DOM.

Static Method Summary
| `htmlEqual(string str1, string str2) ⇒ boolean` Returns whether two strings of html are equal, ignoring any saved carets. Thus two strings of html whose only difference is the id of their saved carets will be considered equal, since they represent html with the same selection.