goog.dom.pattern
Namespacegoog.dom.pattern.AbstractPattern
ClassBase pattern class for DOM matching. … more
goog.dom.pattern.AllChildren
ClassPattern object that matches any nodes at or below the current tree depth. … more
.BREAKING_TEXTNODE_RE
{RegExp
}Regular expression for breaking text nodes.
goog.dom.pattern.ChildMatches
ClassPattern object that matches any nodes at or below the current tree depth. … more
goog.dom.pattern.EndTag
ClassPattern object that matches a closing tag. … more
goog.dom.pattern.FullTag
ClassPattern object that matches a full tag including all its children. … more
goog.dom.pattern.MatchType
EnumWhen matched to a token, a pattern may return any of the following statuses:
NO_MATCH
- The pattern does not match. This is the only
value that evaluates to false
in a boolean context.
MATCHING
- The token is part of an incomplete match.
MATCH
- The token completes a match.
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
.
goog.dom.pattern.Matcher
ClassGiven 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
goog.dom.pattern.NodeType
ClassPattern object that matches any node of the given type. … more
goog.dom.pattern.Repeat
ClassPattern object that matches a repetition of another pattern. … more
goog.dom.pattern.Sequence
ClassPattern object that matches a sequence of other patterns. … more
goog.dom.pattern.StartTag
ClassPattern object that matches an opening tag. … more
goog.dom.pattern.Tag
ClassPattern object that matches an tag. … more
goog.dom.pattern.Text
ClassPattern object that matches text by exact matching or regular expressions. … more
goog.dom.pattern.callback
Namespace.matchStringOrRegex(obj, str)
Utility function to match a string against either a string or a regular expression.
obj
{string
|RegExp
}
str
{string
}
boolean
}
.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
}
index
{string
}
orig
{Object
}
boolean
}