From 0adc6f5e17593d6bd42e6c0586eb85000883dec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 15:34:47 -0400 Subject: [PATCH] Menu: Remove need to pass an event for next(), previous(), focus(). --- ui/jquery.ui.autocomplete.js | 4 ++-- ui/jquery.ui.menu.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 1fc01d7a4..8ab48ba03 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -225,7 +225,7 @@ $.widget( "ui.autocomplete", { 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 { @@ -468,7 +468,7 @@ $.widget( "ui.autocomplete", { }, this.options.position )); if ( this.options.autoFocus ) { - this.menu.next( new $.Event("mouseover") ); + this.menu.next(); } }, diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 36f7e1de4..b3f323cec 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -340,7 +340,7 @@ $.widget( "ui.menu", { // 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() {