Skip to content

Commit 70de1a5

Browse files
author
Tomas Kirda
committed
Rev for 1.4.4 release
1 parent a7e84a4 commit 70de1a5

5 files changed

+18
-7
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
55
"authors": [
66
"Tomas Kirda"

devbridge-autocomplete.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ajax",
77
"autocomplete"
88
],
9-
"version": "1.4.3",
9+
"version": "1.4.4",
1010
"author": {
1111
"name": "Tomas Kirda",
1212
"url": "https://github.com/tkirda"

dist/jquery.autocomplete.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Ajax Autocomplete for jQuery, version 1.4.3
2+
* Ajax Autocomplete for jQuery, version 1.4.4
33
* (c) 2017 Tomas Kirda
44
*
55
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@@ -192,7 +192,6 @@
192192
container.children('.' + selected).removeClass(selected);
193193
});
194194

195-
196195
// Listen for click event on suggestions list:
197196
container.on('click.autocomplete', suggestionSelector, function () {
198197
that.select($(this).data('index'));
@@ -457,6 +456,11 @@
457456
},
458457

459458
onValueChange: function () {
459+
if (this.ignoreValueChange) {
460+
this.ignoreValueChange = false;
461+
return;
462+
}
463+
460464
var that = this,
461465
options = that.options,
462466
value = that.el.val(),
@@ -856,6 +860,7 @@
856860
if (that.selectedIndex === 0) {
857861
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
858862
that.selectedIndex = -1;
863+
that.ignoreValueChange = false;
859864
that.el.val(that.currentValue);
860865
that.findBestHint();
861866
return;
@@ -898,8 +903,14 @@
898903
}
899904

900905
if (!that.options.preserveInput) {
906+
// During onBlur event, browser will trigger "change" event,
907+
// because value has changed, to avoid side effect ignore,
908+
// that event, so that correct suggestion can be selected
909+
// when clicking on suggestion with a mouse
910+
that.ignoreValueChange = true;
901911
that.el.val(that.getValue(that.suggestions[index].value));
902912
}
913+
903914
that.signalHint(null);
904915
},
905916

dist/jquery.autocomplete.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "Autocomplete provides suggestions while you type into the text field.",
55
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
66
"author": "Tomas Kirda (https://twitter.com/tkirda)",

0 commit comments

Comments
 (0)