var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
if ( false !== this._trigger( "focus", event, { item: item } ) ) {
// use value to match what will end up in the input, if it was a key event
- if ( /^key/.test(event.originalEvent.type) ) {
+ if ( event.originalEvent && /^key/.test(event.originalEvent.type) ) {
this._value( item.value );
}
} else {
}, this.options.position ));
if ( this.options.autoFocus ) {
- this.menu.next( new $.Event("mouseover") );
+ this.menu.next();
}
},
// highlight active parent menu item, if any
this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );
- if ( event.type === "keydown" ) {
+ if ( event && event.type === "keydown" ) {
this._close();
} else {
this.timer = this._delay(function() {