From ddf13472ddd0328a39229914685c27a61f5c03af Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 15 May 2013 21:04:10 +0200 Subject: Selectmenu: use dynamic binding for document event --- ui/jquery.ui.selectmenu.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 339246304..76224fd7b 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -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 ); }, -- cgit v1.2.3