moderator-toolbox-nxg-for-reddit / util/ui/highlight
util/ui/highlight¶
Functions¶
highlight()¶
highlight(
element,pat,ignore?,actionReason?):void
Defined in: extension/data/util/ui/highlight.ts:15
Highlights occurrences of pat inside element by wrapping matched text nodes
in <span class="toolbox-highlight"> (or toolbox-highlight-action-reason when
actionReason is true). Skips <script> / <style> subtrees and anything
inside .usertext-edit.
Parameters¶
element¶
Element
The root element whose text nodes are searched.
pat¶
string | RegExp | string[]
String, array of strings, or RegExp to match.
ignore?¶
boolean = false
When true, performs accent/diacritic-insensitive matching.
actionReason?¶
boolean = false
When true, uses the action-reason highlight class instead of the default.
Returns¶
void
removeHighlight()¶
removeHighlight(
element):void
Defined in: extension/data/util/ui/highlight.ts:35
Removes all highlight spans previously added by highlight.
Parameters¶
element¶
Element
Returns¶
void