dom.TextRangeIterator Extends goog.dom.RangeIterator
Subclass of goog.dom.TagIterator that iterates over a DOM range. It adds functions to determine the portion of each text node that is selected.

Inheritance

Object
     goog.iter.Iterator
          goog.dom.TagIterator
               goog.dom.RangeIterator
                    goog.dom.TextRangeIterator

Constructor

goog.dom.TextRangeIterator(startNodestartOffsetendNodeendOffsetopt_reverse)

Parameters

startNode :
The starting node position.
startOffset :
The offset in to startNode. If startNode is an element, indicates an offset in to childNodes. If startNode is a text node, indicates an offset in to nodeValue.
endNode :
The ending node position.
endOffset :
The offset in to endNode. If endNode is an element, indicates an offset in to childNodes. If endNode is a text node, indicates an offset in to nodeValue.
opt_reverse :
Whether to traverse nodes in reverse.

Instance Methods

Public Protected Private
No description.
Returns:   An identical iterator.
code »
copyFrom(other)
Replace this iterator's values with values from another.
Arguments:
other :
The iterator to copy.
code »
getEndNode()
No description.
code »
getEndTextOffset()
No description.
code »
getStartNode()
No description.
code »
getStartTextOffset()
No description.
code »
isLast()
No description.
code »
next()
Move to the next position in the selection. Throws {@code goog.iter.StopIteration} when it passes the end of the range.
Returns:   The node at the next position.
code »
setEndNode(node)
Change the end node of the iterator.
Arguments:
node :
The new end node.
code »
setStartNode(node)
Change the start node of the iterator.
Arguments:
node :
The new start node.
code »
getEndNode()
No description.
Returns:   The iterator's end node.
code »
getEndTextOffset()
No description.
Returns:   The end offset into the current node, or -1 if the current node is not a text node.
code »
getStartNode()
No description.
Returns:   node The iterator's start node.
code »
getStartTextOffset()
No description.
Returns:   The offset into the current node, or -1 if the current node is not a text node.
code »
isLast()
No description.
Returns:   Whether a call to next will fail.
code »
clone()
No description.
Returns:   A copy of this iterator.
code »
copyFrom(other)
Replace this iterator's values with values from another.
Arguments:
other :
The iterator to copy.
code »
equals(other)
Test if two iterators are at the same position - i.e. if the node and tagType is the same. This will still return true if the two iterators are moving in opposite directions or have different constraints.
Arguments:
other :
The iterator to compare to.
Returns:   Whether the two iterators are at the same position.
code »
isEndTag()
No description.
Returns:   Whether this iterator's position is an end tag position.
code »
isNonElement()
No description.
Returns:   Whether this iterator's position is not at an element node.
code »
isStartTag()
No description.
Returns:   Whether this iterator's position is a start tag position.
code »
isStarted()
No description.
Returns:   Whether next has ever been called on this iterator.
code »
next()
Move to the next position in the DOM tree.
Returns:   Returns the next node, or throws a goog.iter.StopIteration exception if the end of the iterator's range has been reached.
code »
restartTag()
No description.
code »
setPosition(nodeopt_tagTypeopt_depth)
Set the position of the iterator. Overwrite the tree node and the position type which can be one of the {@link goog.dom.TagWalkType} token types. Only overwrites the tree depth when the parameter is specified.
Arguments:
node :
The node to set the position to.
opt_tagType :
?goog.dom.TagWalkType
The type of the position Defaults to the start of the given node.
opt_depth :
The tree depth.
code »
skipTag()
No description.
code »
splice(var_args)
Replace the current node with the list of nodes. Reset the iterator so that it visits the first of the nodes next.
Arguments:
var_args :
A list of nodes to replace the current node with. If the first argument is array-like, it will be used, otherwise all the arguments are assumed to be nodes.
code »
__iterator__(opt_keys)
Returns the {@code Iterator} object itself. This is used to implement the iterator protocol in JavaScript 1.7
Arguments:
opt_keys :
Whether to return the keys or values. Default is to only return the values. This is being used by the for-in loop (true) and the for-each-in loop (false). Even though the param gives a hint about what the iterator will return there is no guarantee that it will return the keys when true is passed.
Returns:   The object itself.
code »
next()
*
Returns the next value of the iteration. This will throw the object {@see goog.iter#StopIteration} when the iteration passes the end.
Returns: 
*
  Any object or value.
code »

Instance Properties

endNode_ :
The last node in the selection.
Code »
endOffset_ :
The offset within the last node in the selection.
Code »
startNode_ :
The first node in the selection.
Code »
startOffset_ :
The offset within the first node in the selection.
Code »
node :
The node this position is located on.
Code »
started_ :
Whether iteration has started.
Code »

Package dom

Package Reference