From: Jörn Zaefferer Date: Wed, 7 Mar 2012 18:17:09 +0000 (+0100) Subject: Accordion: Fix unbinding of accordion event option when dealing with multiple events... X-Git-Tag: 1.9m7~13^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=050958277317cf127b98f8ac26f70f57cf147b26;p=jquery-ui.git Accordion: Fix unbinding of accordion event option when dealing with multiple events. Make sure to unbind only those namespaced to .accordion --- diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 8206b1d62..74a9a3177 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -152,6 +152,7 @@ test( "{ event: custom }", function() { // ensure old event handlers are unbound element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" ); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" ); equal( element.accordion( "option", "active" ), 2 ); accordion_state( element, 0, 0, 1 ); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index f4747d168..bf8434c6d 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -162,8 +162,7 @@ $.widget( "ui.accordion", { if ( key === "event" ) { if ( this.options.event ) { - // TODO: this is incorrect for multiple events (see _setupEvents) - this.headers.unbind( this.options.event + ".accordion", this._eventHandler ); + this.headers.unbind( this.options.event.split( " " ).join( ".accordion " ) + ".accordion", this._eventHandler ); } this._setupEvents( value ); }