Always select matching result in autocomplete (fix #357)
This commit is contained in:
parent
805bca7a97
commit
5ca8b3f6a1
1 changed files with 3 additions and 1 deletions
|
@ -282,8 +282,10 @@ L.S.AutoComplete.BaseSelect = L.S.AutoComplete.extend({
|
||||||
var results = [],
|
var results = [],
|
||||||
self = this,
|
self = this,
|
||||||
count = 0;
|
count = 0;
|
||||||
|
val = val.toLowerCase();
|
||||||
this.forEach(this.el, function (item) {
|
this.forEach(this.el, function (item) {
|
||||||
if (item.innerHTML.toLowerCase().indexOf(val.toLowerCase()) !== -1 && !item.selected && count < self.options.maxResults) {
|
var candidate = item.innerHTML.toLowerCase();
|
||||||
|
if (candidate === val || (candidate.indexOf(val) !== -1 && !item.selected && count < self.options.maxResults)) {
|
||||||
results.push(self.optionToResult(item));
|
results.push(self.optionToResult(item));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue