testing.MockRange.ConcreteRange_ Extends goog.dom.AbstractRange
Concrete subclass of goog.dom.AbstractRange that simply sets the abstract method __iterator__ to undefined so that javascript defaults to iterating through all of the object's properties.

Inheritance

Constructor

goog.testing.MockRange.ConcreteRange_()

Instance Methods

Public Protected Private
__iterator__(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.
Arguments:
opt_keys : boolean=
Unused for this iterator.
Returns: !goog.dom.RangeIterator  An iterator over tags in the range.
code »
clone() !goog.dom.AbstractRange
No description.
Returns: !goog.dom.AbstractRange  A clone of this range.
code »
collapse(toAnchor)
Collapses the range to one of its boundary points.
Arguments:
toAnchor : boolean
Whether to collapse to the anchor of the range.
code »
containsNode(nodeopt_allowPartial) boolean
Tests if this range contains the given node.
Arguments:
node : Node
The node to test for.
opt_allowPartial : boolean=
If not set or false, the node must be entirely contained in the selection for this function to return true.
Returns: boolean  Whether this range contains the given node.
code »
containsRange(rangeopt_allowPartial) boolean
Tests if this range contains the given range.
Arguments:
range : goog.dom.AbstractRange
The range to test.
opt_allowPartial : boolean=
If true, the range can be partially contained in the selection, otherwise the range must be entirely contained.
Returns: boolean  Whether this range contains the given range.
code »
getAnchorNode() Node
No description.
Returns: Node  The element or text node the range is anchored at.
code »
getAnchorOffset() number
No description.
Returns: number  The offset into the node the range is anchored at. For text nodes, this is an offset into the node value. For elements, this is an offset into the childNodes array.
code »
getBrowserRangeObject() Range | TextRange
No description.
Returns: Range | TextRange  The native browser range object.
code »
getContainer() Node
No description.
Returns: Node  The deepest node that contains the entire range.
code »
getContainerElement() Element
Returns the deepest element in the tree that contains the entire range.
Returns: Element  The deepest element that contains the entire range.
code »
getDocument() !Document
No description.
Returns: !Document  The document this selection is a part of.
code »
getEndNode() Node
No description.
Returns: Node  The element or text node the range ends in.
code »
getEndOffset() number
No description.
Returns: number  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 »
getEndPosition() goog.math.Coordinate
No description.
Returns: goog.math.Coordinate  The coordinate of the selection end node and offset.
code »
getFocusNode() Node
No description.
Returns: Node  The element or text node the range is focused at - i.e. where the cursor is.
code »
getFocusOffset() number
No description.
Returns: number  The offset into the node the range is focused at - i.e. where the cursor is. For text nodes, this is an offset into the node value. For elements, this is an offset into the childNodes array.
code »
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 #getValidHtml instead.
Returns: string  HTML fragment of the range, does not include context containing elements.
code »
getPastableHtml() string
Returns pastable HTML for this range. This guarantees that any child items that must have specific ancestors will have them, for instance all TDs will be contained in a TR in a TBODY in a TABLE and all LIs will be contained in a UL or OL as appropriate. This is semi-fast on all browsers.
Returns: string  Pastable HTML of the range, including context containing elements.
code »
getStartNode() Node
No description.
Returns: Node  The element or text node the range starts in. For text ranges, the range comprises all text between the start and end position. For other types of range, start and end give bounds of the range but do not imply all nodes in those bounds are selected.
code »
getStartOffset() number
No description.
Returns: number  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 »
getStartPosition() goog.math.Coordinate
No description.
Returns: goog.math.Coordinate  The coordinate of the selection start node and offset.
code »
getText() string
No description.
Returns: string  The text content of the range.
code »
getTextRange(i) goog.dom.TextRange
Get the i-th text range in this range. The behavior is undefined if i >= getTextRangeCount or i < 0.
Arguments:
i : number
The range number to retrieve.
Returns: goog.dom.TextRange  The i-th text range.
code »
getTextRangeCount() number
No description.
Returns: number  The number of text ranges in this range.
code »
getTextRanges() !Array.<goog.dom.TextRange>
Gets an array of all text ranges this range is comprised of. For non-multi ranges, returns a single element array containing this.
Returns: !Array.<goog.dom.TextRange>  Array of text ranges.
code »
getType() goog.dom.RangeType
No description.
Returns: goog.dom.RangeType  The type of range represented by this object.
code »
getValidHtml() string
Returns valid HTML for this range. This is fast on IE, and semi-fast on other browsers.
Returns: string  Valid HTML of the range, including context containing elements.
code »
getWindow() !Window
No description.
Returns: !Window  The window this selection is a part of.
code »
insertNode(nodebefore) Node
Inserts a node before (or after) the range. The range may be disrupted beyond recovery because of the way this splits nodes.
Arguments:
node : Node
The node to insert.
before : boolean
True to insert before, false to insert after.
Returns: Node  The node added to the document. This may be different than the node parameter because on IE we have to clone it.
code »
isCollapsed() boolean
No description.
Returns: boolean  Whether the range is collapsed.
code »
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.
Returns: boolean  Whether the range is valid.
code »
isReversed() boolean
No description.
Returns: boolean  Whether the selection is reversed.
code »
replaceContentsWithNode(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.
Arguments:
node : Node
The node to insert.
Returns: Node  The node added to the document. This may be different than the node parameter because on IE we have to clone it.
code »
saveUsingCarets() ?goog.dom.SavedCaretRange
Saves the range using HTML carets. As long as the carets remained in the HTML, the range can be restored...even when the HTML is copied across documents.
Returns: ?goog.dom.SavedCaretRange  A range representation that can be restored as long as carets are not removed. Returns null if carets could not be created.
code »
saveUsingDom() !goog.dom.SavedRange
Saves the range so that if the start and end nodes are left alone, it can be restored.
Returns: !goog.dom.SavedRange  A range representation that can be restored as long as the endpoint nodes of the selection are not modified.
code »
setBrowserRangeObject(nativeRange) boolean
Sets the native browser range object, overwriting any state this range was storing.
Arguments:
nativeRange : Range | TextRange
The native browser range object.
Returns: boolean  Whether the given range was accepted. If not, the caller will need to call goog.dom.Range.createFromBrowserRange to create a new range object.
code »
surroundWithNodes(startNodeendNode)
Surrounds this range with the two given nodes. The range may be disrupted beyond recovery because of the way this splits nodes.
Arguments:
startNode : Element
The node to insert at the start.
endNode : Element
The node to insert at the end.
code »

Instance Properties

constructor :
No description.
Code »
removeContents :
Removes the contents of the range from the document.
Code »
select :
Sets this range as the selection in its window.
Code »

Static Properties

goog.testing.MockRange.ConcreteRange_.superClass_ :
No description.
Code »

Package testing.MockRange

Package Reference