diff --git a/source/Ox.js b/source/Ox.js index 184502de..6a17fff7 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -3866,7 +3866,7 @@ Ox.highlight 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'), '$1' ) : txt;