annotate.js
No description.

File Location

/goog/dom/annotate.js


Public Protected Private

Global Functions

goog.dom.annotate.annotateTerms(nodetermsannotateFnopt_ignoreCaseopt_classesToSkipopt_maxMs) boolean
Calls annotateFn for each occurrence of a search term in text nodes under node. Returns the number of hits.
Arguments:
node : Node
A DOM node.
terms : Array
An array of [searchTerm, matchWholeWordOnly] tuples. The matchWholeWordOnly value is a per-term attribute because some terms may be CJK, while others are not. (For correctness, matchWholeWordOnly should always be false for CJK terms.).
annotateFn : goog.dom.annotate.AnnotateFn
No description.
opt_ignoreCase : *=
Whether to ignore the case of the query terms when looking for matches.
opt_classesToSkip : Array.<string>>
Nodes with one of these CSS class names (and its descendants) will be skipped.
opt_maxMs : number=
Number of milliseconds after which this function, if still annotating, should stop and return.
Returns: boolean  Whether any terms were annotated.
code »
goog.dom.annotate.annotateTermsInNode_(nodetermsannotateFnignoreCaseclassesToSkipstopTimerecursionLevel) boolean
Recursive helper function.
Arguments:
node : Node
A DOM node.
terms : Array
An array of [searchTerm, matchWholeWordOnly] tuples. The matchWholeWordOnly value is a per-term attribute because some terms may be CJK, while others are not. (For correctness, matchWholeWordOnly should always be false for CJK terms.).
annotateFn : goog.dom.annotate.AnnotateFn
No description.
ignoreCase : *
Whether to ignore the case of the query terms when looking for matches.
classesToSkip : Array.<string>
Nodes with one of these CSS class names will be skipped (as will their descendants).
stopTime : number
Deadline for annotation operation (ignored if 0).
recursionLevel : number
How deep this recursive call is; pass the value 0 in the initial call.
Returns: boolean  Whether any terms were annotated.
code »
goog.dom.annotate.annotateText(texttermsannotateFnopt_ignoreCase) goog.html.SafeHtml
Annotates occurrences of query terms in plain text. This process consists of identifying all occurrences of all query terms, calling a provided function to get the appropriate replacement HTML for each occurrence, and HTML-escaping all the text.
Arguments:
text : string
The plain text to be searched.
terms : Array
An array of [{string} searchTerm, {boolean} matchWholeWordOnly] tuples. The matchWholeWordOnly value is a per-term attribute because some terms may be CJK, while others are not. (For correctness, matchWholeWordOnly should always be false for CJK terms.).
annotateFn : goog.dom.annotate.AnnotateFn
No description.
opt_ignoreCase : *=
Whether to ignore the case of the query terms when looking for matches.
Returns: goog.html.SafeHtml  The HTML equivalent of text with terms annotated, or null if the text did not contain any of the terms.
code »
goog.dom.annotate.helpAnnotateText_(texttermsannotateFnignoreCase) goog.html.SafeHtml
Annotates occurrences of query terms in plain text. This process consists of identifying all occurrences of all query terms, calling a provided function to get the appropriate replacement HTML for each occurrence, and HTML-escaping all the text.
Arguments:
text : string
The plain text to be searched.
terms : Array
An array of [{string} searchTerm, {boolean} matchWholeWordOnly] tuples. If ignoreCase is true, each search term must already be lowercase. The matchWholeWordOnly value is a per-term attribute because some terms may be CJK, while others are not. (For correctness, matchWholeWordOnly should always be false for CJK terms.).
annotateFn : goog.dom.annotate.AnnotateFn
No description.
ignoreCase : *
Whether to ignore the case of the query terms when looking for matches.
Returns: goog.html.SafeHtml  The HTML equivalent of text with terms annotated, or null if the text did not contain any of the terms.
code »
goog.dom.annotate.lowercaseTerms_(terms) !Array
Converts terms to lowercase.
Arguments:
terms : Array
An array of [{string} searchTerm, {boolean} matchWholeWordOnly] tuples.
Returns: !Array  An array of [{string} searchTerm, {boolean} matchWholeWordOnly] tuples.
code »

Directory dom

File Reference