Skip to content

Commit

Permalink
Selectmenu: use method _documentClick for adding events to the document
Browse files Browse the repository at this point in the history
  • Loading branch information
fnagel committed Dec 12, 2012
1 parent f6372bd commit 0732835
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ui/jquery.ui.selectmenu.js
Expand Up @@ -43,14 +43,7 @@ $.widget( "ui.selectmenu", {
this._drawButton();
this._drawMenu();

// document click closes menu
this._on( document, {
click: function( event ) {
if ( this.isOpen && !$( event.target ).closest( "li.ui-state-disabled, li.ui-selectmenu-optgroup, #" + this.ids.button ).length ) {
this.close( event );
}
}
});
this._on( document, this._documentClick );

if ( this.options.disabled ) {
this.disable();
Expand Down Expand Up @@ -304,6 +297,14 @@ $.widget( "ui.selectmenu", {
}
},

_documentClick: {
click: function( event ) {
if ( this.isOpen && !$( event.target ).closest( "li.ui-state-disabled, li.ui-selectmenu-optgroup, #" + this.ids.button ).length ) {
this.close( event );
}
}
},

_buttonEvents: {
focus: function() {
// init Menu on first focus
Expand Down

0 comments on commit 0732835

Please sign in to comment.