]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Make check for click outside of menu a function which can be overridden. Fixes...
authorKris Borchers <kris.borchers@gmail.com>
Thu, 1 Aug 2013 01:20:13 +0000 (20:20 -0500)
committerKris Borchers <kris.borchers@gmail.com>
Mon, 12 Aug 2013 00:11:23 +0000 (19:11 -0500)
ui/jquery.ui.menu.js

index b4f0d48c1dce3ca0f780070d299a60bd09f1226d..3352eb8bd142d0ddd0adc749518bef722559b99d 100644 (file)
@@ -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 );