The goog.dom.pattern Namespace

The goog.dom.pattern.AbstractPattern Class

Base pattern class for DOM matching. … more

The goog.dom.pattern.AllChildren Class

Pattern object that matches any nodes at or below the current tree depth. … more

.BREAKING_TEXTNODE_RE {RegExp}

Regular expression for breaking text nodes.

The goog.dom.pattern.ChildMatches Class

Pattern object that matches any nodes at or below the current tree depth. … more

The goog.dom.pattern.EndTag Class

Pattern object that matches a closing tag. … more

The goog.dom.pattern.FullTag Class

Pattern object that matches a full tag including all its children. … more

The goog.dom.pattern.MatchType Enum

When matched to a token, a pattern may return any of the following statuses:

  1. NO_MATCH - The pattern does not match. This is the only value that evaluates to false in a boolean context.
  2. MATCHING - The token is part of an incomplete match.
  3. MATCH - The token completes a match.
  4. BACKTRACK_MATCH - The token does not match, but indicates the end of a repetitive match. For instance, in regular expressions, the pattern /a+/ would match 'aaaaaaaab'. Every 'a' token would give a status of MATCHING while the 'b' token would give a status of BACKTRACK_MATCH.
… more

The goog.dom.pattern.Matcher Class

Given a set of patterns and a root node, this class tests the patterns in parallel. It is not (yet) a smart matcher - it doesn't do any advanced backtracking. Given the pattern DIV, SPAN the matcher will not match DIV, DIV, SPAN because it starts matching at the first DIV, fails to match SPAN at the second, and never backtracks to try again. It is also possible to have a set of complex patterns that when matched in parallel will miss some possible matches. Running multiple times will catch all matches eventually. … more

The goog.dom.pattern.NodeType Class

Pattern object that matches any node of the given type. … more

The goog.dom.pattern.Repeat Class

Pattern object that matches a repetition of another pattern. … more

The goog.dom.pattern.Sequence Class

Pattern object that matches a sequence of other patterns. … more

The goog.dom.pattern.StartTag Class

Pattern object that matches an opening tag. … more

The goog.dom.pattern.Tag Class

Pattern object that matches an tag. … more

The goog.dom.pattern.Text Class

Pattern object that matches text by exact matching or regular expressions. … more

The goog.dom.pattern.callback Namespace

… more

.matchStringOrRegex(obj, str)

Utility function to match a string against either a string or a regular expression.

obj {string|RegExp}
Either a string or a regular expression.
str {string}
The string to match.
returns {boolean}
Whether the strings are equal, or if the string matches the regular expression.

.matchStringOrRegexMap(elem, index, orig)

Utility function to match a DOM attribute against either a string or a regular expression. Conforms to the interface spec for {@link goog.object#every}.

elem {string|RegExp}
Either a string or a regular expression.
index {string}
The attribute name to match.
orig {Object}
The original map of matches to test.
returns {boolean}
Whether the strings are equal, or if the attribute matches the regular expression. @this {Element} Called using goog.object every on an Element.