Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplete Change event does not fire in IE.

This commit is contained in:
Scott González 2010-09-24 16:49:10 -04:00
parent a3da1045a1
commit 0ccc78698b

View 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 } ) ) {