From b07827d98c322f7a830f1d1c4dd3d7901e443fc7 Mon Sep 17 00:00:00 2001 From: Trax Date: Tue, 12 Feb 2019 12:50:12 +0100 Subject: [PATCH] attempt of fixing #684 Calling of `options.onInvalidateSelection` in onBlur timer. --- src/jquery.autocomplete.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index b5a17bd..b587c18 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -227,12 +227,19 @@ }, onBlur: function () { - var that = this; + var that = this, + options = that.options, + value = that.el.val(), + query = that.getQuery(value); // If user clicked on a suggestion, hide() will // be canceled, otherwise close suggestions that.blurTimeoutId = setTimeout(function () { that.hide(); + + if (that.selection && that.currentValue !== query) { + (options.onInvalidateSelection || $.noop).call(that.element); + } }, 200); },