mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-12-23 03:18:55 +00:00
Fix issue of highlighting string when it contains html specific characters, fixes #385
This commit is contained in:
parent
9d06ec6f19
commit
3328147b93
@ -127,15 +127,15 @@
|
||||
$.Autocomplete = Autocomplete;
|
||||
|
||||
Autocomplete.formatResult = function (suggestion, currentValue) {
|
||||
var htmlSafeString = suggestion.value
|
||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
|
||||
|
||||
return suggestion.value
|
||||
.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
|
||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
|
||||
|
||||
return htmlSafeString.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
|
||||
.replace(/"/g, '"')
|
||||
.replace(/<(\/?strong)>/g, '<$1>');
|
||||
};
|
||||
|
||||
Autocomplete.prototype = {
|
||||
|
Loading…
Reference in New Issue
Block a user