From 9a4eecdf85bf0a3accd7acb9fead64d6b5aad18e Mon Sep 17 00:00:00 2001 From: Robson Braga Araujo Date: Wed, 11 Aug 2010 07:02:50 +0800 Subject: [PATCH] Autocomplete: changed the search function to always store the last term that was entered by the user. Fixed #5922 - autocomplete: Search not triggered if the first letter is the same as the first letter of a previous erased content --- ui/jquery.ui.autocomplete.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 8380df8ad..4cd1b0548 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -229,6 +229,10 @@ $.widget( "ui.autocomplete", { search: function( value, event ) { value = value != null ? value : this.element.val(); + + // always save the actual value, not the one passed as an argument + this.term = this.element.val(); + if ( value.length < this.options.minLength ) { return this.close( event ); } @@ -242,10 +246,7 @@ $.widget( "ui.autocomplete", { }, _search: function( value ) { - this.term = this.element - .addClass( "ui-autocomplete-loading" ) - // always save the actual value, not the one passed as an argument - .val(); + this.element.addClass( "ui-autocomplete-loading" ); this.source( { term: value }, this.response ); }, -- 2.39.5