From d333dbf554bcd4299e6d98731aab2cac1e86ad7b Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 16 May 2011 13:32:31 +0200 Subject: [PATCH] make highlight errors go away --- source/Ox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;