Selectmenu: use dynamic binding for document event

This commit is contained in:
Felix Nagel 2013-05-15 21:04:10 +02:00
parent 97cca1ed78
commit ddf13472dd

View File

@ -49,8 +49,6 @@ $.widget( "ui.selectmenu", {
this._drawButton();
this._drawMenu();
this._on( document, this._documentClick );
if ( this.options.disabled ) {
this.disable();
}
@ -196,6 +194,8 @@ $.widget( "ui.selectmenu", {
this._toggleAttr();
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
this._on( this.document, this._documentClick );
this._trigger( "open", event );
},
@ -212,6 +212,8 @@ $.widget( "ui.selectmenu", {
this.menu.menu( "focus", null, this._getSelectedItem() );
}
this._off( this.document );
this._trigger( "close", event );
},