diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-03-20 16:17:56 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-03-20 16:17:56 -0400 |
commit | 1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05 (patch) | |
tree | 2eb7f445e48cfe05f595ca7cd28cacc8c89f2dfc /ui | |
parent | c61bd8ec67d9a863a00ae9d188993680f83186b0 (diff) | |
download | jquery-ui-1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05.tar.gz jquery-ui-1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05.zip |
Menu: pass the original event to the select callback.
Fixes #5343 - Add option to allow form submission when option is chosen.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 021b330a6..fab7a6287 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -60,7 +60,7 @@ $.widget( "ui.autocomplete", { if ( !self.menu.active ) { return; } - self.menu.select(); + self.menu.select( event ); break; case keyCode.ESCAPE: self.element.val( self.term ); @@ -334,13 +334,13 @@ $.widget("ui.menu", { role: "listbox", "aria-activedescendant": "ui-active-menuitem" }) - .click(function(e) { - if ( !$( e.target ).closest( ".ui-menu-item" ).length ) { + .click(function( event ) { + if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { return; } // temporary - e.preventDefault(); - self.select(); + event.preventDefault(); + self.select( event ); }); this.refresh(); }, @@ -481,8 +481,8 @@ $.widget("ui.menu", { return this.element.height() < this.element.attr("scrollHeight"); }, - select: function() { - this._trigger("selected", null, { item: this.active }); + select: function( event ) { + this._trigger("selected", event, { item: this.active }); } }); |