From: Scott González Date: Fri, 24 Sep 2010 20:49:10 +0000 (-0400) Subject: Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplet... X-Git-Tag: 1.8.6~59 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0ccc78698b55d5e1bc336bb754b546a9ad19ea5c;p=jquery-ui.git Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplete Change event does not fire in IE. --- diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 176f81e0a..3dbcb9cf4 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -160,6 +160,12 @@ $.widget( "ui.autocomplete", { if ( self.element[0] !== doc.activeElement ) { self.element.focus(); self.previous = previous; + // #6109 - IE triggers two focus events and the second + // is asynchronous, so we need to reset the previous + // term synchronously and asynchronously :-( + setTimeout(function() { + self.previous = previous; + }, 1); } if ( false !== self._trigger( "select", event, { item: item } ) ) {