]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Remove need to pass an event for next(), previous(), focus().
authorScott González <scott.gonzalez@gmail.com>
Fri, 18 May 2012 19:34:47 +0000 (15:34 -0400)
committerScott González <scott.gonzalez@gmail.com>
Fri, 18 May 2012 19:34:47 +0000 (15:34 -0400)
ui/jquery.ui.autocomplete.js
ui/jquery.ui.menu.js

index 1fc01d7a4d2537534f06636aee46e9b5da5dfe4f..8ab48ba032da69f90aac3a66fbc4174f0ba7dd6c 100644 (file)
@@ -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();
                }
        },
 
index 36f7e1de4c7b6a0a944e045dd979350926b6ddaa..b3f323cecb37732a411c02e066cd5926af388be9 100644 (file)
@@ -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() {