mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2025-04-11 01:41:49 +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 = Autocomplete;
|
||||||
|
|
||||||
Autocomplete.formatResult = function (suggestion, currentValue) {
|
Autocomplete.formatResult = function (suggestion, currentValue) {
|
||||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
|
return suggestion.value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + currentValue.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||||||
|
|
||||||
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Autocomplete.prototype = {
|
Autocomplete.prototype = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user