]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplet...
authorScott González <scott.gonzalez@gmail.com>
Fri, 24 Sep 2010 20:49:10 +0000 (16:49 -0400)
committerScott González <scott.gonzalez@gmail.com>
Fri, 24 Sep 2010 20:49:10 +0000 (16:49 -0400)
ui/jquery.ui.autocomplete.js

index 176f81e0a14aed6aa2a69486b6c2dd0f88fef0c5..3dbcb9cf48aa293abce5234284fd047d23d666d5 100644 (file)
@@ -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 } ) ) {