make highlight errors go away
This commit is contained in:
parent
ce33d3650a
commit
d333dbf554
1 changed files with 1 additions and 1 deletions
|
@ -3866,7 +3866,7 @@ Ox.highlight <f> Highlight matches in a string
|
||||||
@*/
|
@*/
|
||||||
// fixme: with regexp, special chars would have to be escaped
|
// fixme: with regexp, special chars would have to be escaped
|
||||||
Ox.highlight = function(txt, str, classname) {
|
Ox.highlight = function(txt, str, classname) {
|
||||||
return str.length ? txt.replace(
|
return str && str.length ? txt.replace(
|
||||||
new RegExp('(' + str + ')', 'ig'),
|
new RegExp('(' + str + ')', 'ig'),
|
||||||
'<span class="' + classname + '">$1</span>'
|
'<span class="' + classname + '">$1</span>'
|
||||||
) : txt;
|
) : txt;
|
||||||
|
|
Loading…
Reference in a new issue