diff options
author | Kris Borchers <kris.borchers@gmail.com> | 2013-07-31 20:20:13 -0500 |
---|---|---|
committer | Kris Borchers <kris.borchers@gmail.com> | 2013-08-11 19:11:23 -0500 |
commit | cceb163548eea78525a3a60ada95a5af6e3ddf25 (patch) | |
tree | 386561ec5814cf9be1c3a796e2eefe02193f3ba8 | |
parent | 5aa106a052e78559e50a4ca464863f5927c43bd5 (diff) | |
download | jquery-ui-cceb163548eea78525a3a60ada95a5af6e3ddf25.tar.gz jquery-ui-cceb163548eea78525a3a60ada95a5af6e3ddf25.zip |
Menu: Make check for click outside of menu a function which can be overridden. Fixes #8929 - Menu needs adjustement for use in Selectmenu
-rw-r--r-- | ui/jquery.ui.menu.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index b4f0d48c1..3352eb8bd 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -130,7 +130,7 @@ $.widget( "ui.menu", { // Clicks outside of a menu collapse any open menus this._on( this.document, { click: function( event ) { - if ( !$( event.target ).closest( ".ui-menu" ).length ) { + if ( this._closeOnDocumentClick( event ) ) { this.collapseAll( event ); } @@ -502,6 +502,10 @@ $.widget( "ui.menu", { .removeClass( "ui-state-active" ); }, + _closeOnDocumentClick: function( event ) { + return !$( event.target ).closest( ".ui-menu" ).length; + }, + collapse: function( event ) { var newItem = this.active && this.active.parent().closest( ".ui-menu-item", this.element ); |