goog.dom.SavedCaretRange
Classgoog.dom.SavedCaretRange
> goog.dom.SavedRange
> goog.Disposable
goog.dom.SavedCaretRange(range)
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}.
range
{goog.dom.AbstractRange
}
.CARET_REGEX
{RegExp
}A regex that will match all saved range carets in a string.
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Dispose the saved range and remove the carets from the DOM.
.getCaret(start)
Gets carets.
start
{boolean
}
Element
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.htmlEqual(str1, str2)
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.
str1
{string
}
str2
{string
}
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeCarets(opt_range)
Removes the carets from the current restoration document.
opt_range
{goog.dom.AbstractRange
=}
goog.dom.AbstractRange
|undefined
}
.restore(opt_stayAlive)
Inherited from goog.dom.SavedRange
.
Restores the range and by default disposes of the saved copy. Take note: this means the by default SavedRange objects are single use objects.
opt_stayAlive
{boolean
=}
goog.dom.AbstractRange
}
.restoreInternal()
[protected]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.
goog.dom.AbstractRange
?}
.setRestorationDocument(doc)
Sets the document where the range will be restored.
doc
{!Document
}
.toAbstractRange()
Gets the range that this SavedCaretRage represents, without selecting it or removing the carets from the DOM.
goog.dom.AbstractRange
?}