dom.SavedCaretRange Extends goog.dom.SavedRange
A struct for holding context about saved selections.

Inheritance

Object
     goog.Disposable
          goog.dom.SavedRange
               goog.dom.SavedCaretRange

Constructor

goog.dom.SavedCaretRange(range)

Parameters

range :
The range being saved.

Instance Methods

Public Protected Private
createCaret_(start)
Creates a caret element.
Arguments:
start :
If true, creates the start caret. Otherwise, creates the end caret.
Returns:   The new caret element.
code »
disposeInternal()
Dispose the saved range and remove the carets from the DOM.
code »
getCaret(start)
Gets carets.
Arguments:
start :
If true, returns the start caret. Otherwise, get the end caret.
Returns:   The start or end caret in the given document.
code »
removeCarets(opt_range)
Removes the carets from the current restoration document.
Arguments:
opt_range :
A range whose offsets have already been adjusted for caret removal; it will be adjusted if it is also affected by post-removal operations, such as text node normalization.
Returns:   The adjusted range, if opt_range was provided.
code »
restoreInternal()
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.
Returns:   Restored selection.
code »
setRestorationDocument(doc)
Sets the document where the range will be restored.
Arguments:
doc :
An HTML document.
code »
toAbstractRange()
Gets the range that this SavedCaretRage represents, without selecting it or removing the carets from the DOM.
Returns:   An abstract range.
code »
restore(opt_stayAlive)
Restores the range and by default disposes of the saved copy. Take note: this means the by default SavedRange objects are single use objects.
Arguments:
opt_stayAlive :
Whether this SavedRange should stay alive (not be disposed) after restoring the range. Defaults to false (dispose).
Returns:   The restored range.
code »
restoreInternal()
Internal method to restore the saved range.
Returns:   The restored range.
code »
dispose()
No description.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. For example:
mypackage.MyClass = function() {
goog.Disposable.call(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);

mypackage.MyClass.prototype.disposeInternal = function() {
mypackage.MyClass.superClass_.disposeInternal.call(this);
// Dispose logic specific to MyClass.
...
};
code »
getDisposed()
No description.
Returns:   Whether the object has been disposed of.
code »
isDisposed()
No description.
Returns:   Whether the object has been disposed of.
code »

Instance Properties

disposed_ :
Whether the object has been disposed of.
Code »

Static Methods

goog.dom.SavedCaretRange.CARET_REGEX()
A regex that will match all saved range carets in a string.
code »
goog.dom.SavedCaretRange.htmlEqual(str1str2)
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.
Arguments:
str1 :
The first string.
str2 :
The second string.
Returns:   Whether two strings of html are equal, ignoring any saved carets.
code »

Package dom

Package Reference