Skip to content
Permalink
Browse files

Selectmenu: use dynamic binding for document event

  • Loading branch information
fnagel committed May 15, 2013
1 parent 97cca1e commit ddf13472ddd0328a39229914685c27a61f5c03af
Showing with 4 additions and 2 deletions.
  1. +4 −2 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 comment has been minimized.

Copy link
@TrejGun

TrejGun May 16, 2013

shouldn't it be this._off( this.document, this._documentClick ); ?

This comment has been minimized.

Copy link
@fnagel

fnagel May 17, 2013

Author Member

It should remove all events on document within our namespace, should be ok. What do you think @jzaefferer ?

This comment has been minimized.

Copy link
@TrejGun

TrejGun May 17, 2013

is it still ok when i have 2 selectmenus?

This comment has been minimized.

Copy link
@fnagel

fnagel May 17, 2013

Author Member

Tested successfully in default demo, which includes three Selectmenus. Unit test work too.

This comment has been minimized.

Copy link
@TrejGun

This comment has been minimized.

Copy link
@fnagel

fnagel via email May 17, 2013

Author Member

this._trigger( "close", event );
},

0 comments on commit ddf1347

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