mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: use method _documentClick for adding events to the document
This commit is contained in:
parent
f6372bd7ea
commit
07328359e9
17
ui/jquery.ui.selectmenu.js
vendored
17
ui/jquery.ui.selectmenu.js
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user