make highlight errors go away

This commit is contained in:
rolux 2011-05-16 13:32:31 +02:00
parent ce33d3650a
commit d333dbf554

View file

@ -3866,7 +3866,7 @@ Ox.highlight <f> Highlight matches in a string
@*/
// fixme: with regexp, special chars would have to be escaped
Ox.highlight = function(txt, str, classname) {
return str.length ? txt.replace(
return str && str.length ? txt.replace(
new RegExp('(' + str + ')', 'ig'),
'<span class="' + classname + '">$1</span>'
) : txt;