![]()
Calls
annotateFn for each occurrence of a search term in text nodes
under node . Returns the number of hits.
Arguments:
Returns: boolean
Whether any terms were annotated.
|
code » | ||||||||
![]()
Recursive helper function.
Arguments:
Returns: boolean
Whether any terms were annotated.
|
code » | ||||||||
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:
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 » | ||||||||
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:
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 » | ||||||||
Converts terms to lowercase.
|
code » |
![]()
A function that takes:
(1) the number of the term that is "hit",
(2) the HTML (search term) to be annotated,
and returns the annotated term as an HTML.
|
Code » | |
![]()
The maximum recursion depth allowed. Any DOM nodes deeper than this are
ignored.
|
Code » | |
![]()
The node types whose descendants should not be affected by annotation.
|
Code » | |
![]()
Regular expression that matches non-word characters.
Performance note: Testing a one-character string using this regex is as fast
as the equivalent string test ("a-zA-Z0-9_".indexOf(c) < 0), give or take a
few percent. (The regex is about 5% faster in IE 6 and about 4% slower in
Firefox 1.5.) If performance becomes critical, it may be better to convert
the character to a numerical char code and check whether it falls in the
word character ranges. A quick test suggests that could be 33% faster.
|
Code » |