From 534dbce469b88ea222681a10f6029f1ac9a7417b Mon Sep 17 00:00:00 2001 From: xsyfrost Date: Thu, 20 Nov 2014 11:39:59 +0100 Subject: [PATCH] Update formatResult with only non Html replacement Only non HTML replacement. That means replacement between

Your text

is ok, but will not be replaced. --- src/jquery.autocomplete.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 8c4d050..9bcf061 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -126,9 +126,7 @@ $.Autocomplete = Autocomplete; Autocomplete.formatResult = function (suggestion, currentValue) { - var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; - - return suggestion.value.replace(new RegExp(pattern, 'gi'), '$1<\/strong>'); + return suggestion.value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + currentValue.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); }; Autocomplete.prototype = {