dom.browserrange.AbstractRange Extends Object
The constructor for abstract ranges. Don't call this from subclasses.

Inheritance

Object
     goog.dom.browserrange.AbstractRange

Constructor

goog.dom.browserrange.AbstractRange()

Instance Methods

Public Protected Private
__iterator__(opt_keys)
Returns a RangeIterator over the contents of the range. Regardless of the direction of the range, the iterator will move in document order.
Arguments:
opt_keys :
Unused for this iterator.
Returns:   An iterator over tags in the range.
code »
No description.
Returns:   A clone of this range.
code »
collapse()
Collapses the range to one of its boundary points.
code »
compareBrowserRangeEndpoints()
Compares one endpoint of this range with the endpoint of another browser native range object.
Returns:   0 if the endpoints are equal, negative if this range endpoint comes before the other range endpoint, and positive otherwise.
code »
containsBrowserRange(rangeopt_allowPartial)
Tests if this range contains any or all of the given browser range.
Arguments:
range :
Range | TextRange
The browser native range to test.
opt_allowPartial :
If not set or false, the range must be entirely contained in the selection for this function to return true.
Returns:   Whether this range contains the given browser range.
code »
containsNode(nodeopt_allowPartial)
Tests if this range contains the given node.
Arguments:
node :
The node to test.
opt_allowPartial :
If not set or false, the node must be entirely contained in the selection for this function to return true.
Returns:   Whether this range contains the given node.
code »
containsRange(rangeopt_allowPartial)
Tests if this range contains the given range.
Arguments:
range :
The range to test.
opt_allowPartial :
If not set or false, the range must be entirely contained in the selection for this function to return true.
Returns:   Whether this range contains the given range.
code »
getBrowserRange()
Range | TextRange
Returns the browser native implementation of the range. Please refrain from using this function - if you find you need the range please add wrappers for the functionality you need rather than just using the native range.
Returns: 
Range | TextRange
  The browser native range object.
code »
getContainer()
Returns the deepest node in the tree that contains the entire range.
Returns:   The deepest node that contains the entire range.
code »
getEndNode()
Returns the node the range ends in.
Returns:   The element or text node the range ends in.
code »
getEndOffset()
Returns the offset into the node the range ends in.
Returns:   The offset into the node the range ends in. For text nodes, this is an offset into the node value. For elements, this is an offset into the childNodes array.
code »
getHtmlFragment()
Returns the HTML fragment this range selects. This is slow on all browsers.
Returns:   HTML fragment of the range, does not include context containing elements.
code »
getStartNode()
Returns the node the range starts in.
Returns:   The element or text node the range starts in.
code »
getStartOffset()
Returns the offset into the node the range starts in.
Returns:   The offset into the node the range starts in. For text nodes, this is an offset into the node value. For elements, this is an offset into the childNodes array.
code »
getText()
No description.
Returns:   The text content of the range.
code »
getValidHtml()
Returns valid HTML for this range. This is fast on IE, and semi-fast on other browsers.
Returns:   Valid HTML of the range, including context containing elements.
code »
insertNode()
Inserts a node before (or after) the range. The range may be disrupted beyond recovery because of the way this splits nodes.
Returns:   The node added to the document. This may be different than the node parameter because on IE we have to clone it.
code »
isCollapsed()
Tests if the selection is collapsed - i.e. is just a caret.
Returns:   Whether the range is collapsed.
code »
removeContents()
No description.
code »
select()
Set this range as the selection in its window.
code »
surroundContents()
Surrounds the text range with the specified element (on Mozilla) or with a clone of the specified element (on IE). Returns a reference to the surrounding element if the operation was successful; returns null if the operation failed.
Returns:   The surrounding element (same as the argument on Mozilla, but not on IE), or null if unsuccessful.
code »
surroundWithNodes()
Surrounds this range with the two given nodes. The range may be disrupted beyond recovery because of the way this splits nodes.
code »

Package dom

Package Reference