dom.js
No description.

File Location

/goog/testing/editor/dom.js


Public Protected Private

Global Functions

goog.testing.editor.dom.assertRangeBetweenText(beforeafterrangeopt_stopAt)
Assert that the range is surrounded by the given strings. This is useful because different browsers can place the range endpoints inside different nodes even when visually the range looks the same. Also, there may be empty text nodes in the way (again depending on the browser) making it difficult to use assertRangeEquals.
Arguments:
before : string
String that should occur immediately before the start point of the range. If this is the empty string, assert will only succeed if there is no text before the start point of the range.
after : string
String that should occur immediately after the end point of the range. If this is the empty string, assert will only succeed if there is no text after the end point of the range.
range : goog.dom.AbstractRange
The range to be tested.
opt_stopAt : Node=
Node to stop searching at (search will be restricted to this node's subtree).
code »
goog.testing.editor.dom.getTextFollowingRange_&getFollowingTextNode()
No description.
code »
goog.testing.editor.dom.getNextNonEmptyTextNode(nodeopt_stopAtopt_skipDescendants) Text
Returns the next (in document order) node from the given node that is a non-empty text node, or null if none is found or opt_stopAt is not an ancestor of node. Note that if the given node has children, the search will start from the start tag of the node, meaning all its descendants will be included in the search, unless opt_skipDescendants is true.
Arguments:
node : Node
Node to start searching from.
opt_stopAt : Node=
Node to stop searching at (search will be restricted to this node's subtree), defaults to the body of the document containing node.
opt_skipDescendants : boolean=
Whether to skip searching the given node's descentants.
Returns: Text  The next (in document order) node from the given node that is a non-empty text node, or null if none is found or opt_stopAt is not an ancestor of node.
code »
goog.testing.editor.dom.getPreviousNextNonEmptyTextNodeHelper_(nodeopt_stopAtopt_skipDescendantsopt_isPrevious) Text
Helper that returns the previous or next (in document order) node from the given node that is a non-empty text node, or null if none is found or opt_stopAt is not an ancestor of node. Note that if the given node has children, the search will start from the end or start tag of the node (depending on whether it's searching for the previous or next node), meaning all its descendants will be included in the search, unless opt_skipDescendants is true.
Arguments:
node : Node
Node to start searching from.
opt_stopAt : Node=
Node to stop searching at (search will be restricted to this node's subtree), defaults to the body of the document containing node.
opt_skipDescendants : boolean=
Whether to skip searching the given node's descentants.
opt_isPrevious : boolean=
Whether to search for the previous non-empty text node instead of the next one.
Returns: Text  The next (in document order) node from the given node that is a non-empty text node, or null if none is found or opt_stopAt is not an ancestor of node.
code »
goog.testing.editor.dom.getPreviousNonEmptyTextNode(nodeopt_stopAtopt_skipDescendants) Text
Returns the previous (in document order) node from the given node that is a non-empty text node, or null if none is found or opt_stopAt is not an ancestor of node. Note that if the given node has children, the search will start from the end tag of the node, meaning all its descendants will be included in the search, unless opt_skipDescendants is true.
Arguments:
node : Node
Node to start searching from.
opt_stopAt : Node=
Node to stop searching at (search will be restricted to this node's subtree), defaults to the body of the document containing node.
opt_skipDescendants : boolean=
Whether to skip searching the given node's descentants.
Returns: Text  The previous (in document order) node from the given node that is a non-empty text node, or null if none is found.
code »
goog.testing.editor.dom.getRelativeDepth_(nodeparentNode) number
Returns the depth of the given node relative to the given parent node, or -1 if the given node is not a descendant of the given parent node. E.g. if node == parentNode returns 0, if node.parentNode == parentNode returns 1, etc.
Arguments:
node : Node
Node whose depth to get.
parentNode : Node
Node relative to which the depth should be calculated.
Returns: number  The depth of the given node relative to the given parent node, or -1 if the given node is not a descendant of the given parent node.
code »
goog.testing.editor.dom.getTextFollowingRange_(rangeisBeforeopt_stopAt) ?string
Returns the text that follows the given range, where the term "follows" means "comes immediately before the start of the range" if isBefore is true, and "comes immediately after the end of the range" if isBefore is false, or null if no non-empty text node is found.
Arguments:
range : goog.dom.AbstractRange
The range to search from.
isBefore : boolean
Whether to search before the range instead of after it.
opt_stopAt : Node=
Node to stop searching at (search will be restricted to this node's subtree).
Returns: ?string  The text that follows the given range, or null if no non-empty text node is found.
code »
goog.testing.editor.dom.isNonEmptyTextNode_(node) boolean
Returns whether the given node is a non-empty text node.
Arguments:
node : Node
Node to be checked.
Returns: boolean  Whether the given node is a non-empty text node.
code »

Directory editor

File Reference