mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-29 00:06:36 +00:00
Update formatResult with only non Html replacement
Only non HTML replacement. That means replacement between <p>Your text</p> is ok, but <a href="your text" /> will not be replaced.
This commit is contained in:
parent
05a337cba9
commit
534dbce469
@ -126,9 +126,7 @@
|
||||
$.Autocomplete = Autocomplete;
|
||||
|
||||
Autocomplete.formatResult = function (suggestion, currentValue) {
|
||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
|
||||
|
||||
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
|
||||
return suggestion.value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + currentValue.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||||
};
|
||||
|
||||
Autocomplete.prototype = {
|
||||
|
Loading…
Reference in New Issue
Block a user