Home

# Library goog.testing.editor.dom

Function Summary

`assertRangeBetweenText(string before, string after, ?goog.dom.AbstractRange range, ?Node= opt_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.

`getNextNonEmptyTextNode(?Node node, ?Node= opt_stopAt, boolean= opt_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.

`getPreviousNextNonEmptyTextNodeHelper_(?Node node, ?Node= opt_stopAt, boolean= opt_skipDescendants, boolean= opt_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.

`getPreviousNonEmptyTextNode(?Node node, ?Node= opt_stopAt, boolean= opt_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.

| `getRelativeDepth_(?Node node, ?Node parentNode) ⇒ 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.
| `getTextFollowingRange_(?goog.dom.AbstractRange range, boolean isBefore, ?Node= opt_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.
| `isNonEmptyTextNode_(?Node node) ⇒ boolean` Returns whether the given node is a non-empty text node.