Skip to content
Permalink
Browse files

Selectmenu: use method _documentClick for adding events to the document

  • Loading branch information...
fnagel committed Dec 12, 2012
1 parent f6372bd commit 07328359e9f884e7ab23b431797b5d8f06ea9ec9
Showing with 9 additions and 8 deletions.
  1. +9 −8 ui/jquery.ui.selectmenu.js
@@ -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();
@@ -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

0 comments on commit 0732835

Please sign in to comment.
You can’t perform that action at this time.