2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-29 00:06:36 +00:00

Do not try to highlight suggestion if current value is empty, resolves #434

Prevents inserting strong tag after each character when input value is empty.
This commit is contained in:
Tomas Kirda 2015-11-01 19:25:25 -06:00
parent fef68b6e4c
commit e572acf56f

View File

@ -127,6 +127,11 @@
$.Autocomplete = Autocomplete; $.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) { Autocomplete.formatResult = function (suggestion, currentValue) {
// Do not replace anything if there current value is empty
if (!currentValue) {
return suggestion.value;
}
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value return suggestion.value