aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.accordion.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-02-21 16:07:42 +0100
committerScott González <scott.gonzalez@gmail.com>2011-02-21 16:07:59 +0100
commitf70f01af9ea1d1d191b77fab6dadbbe421be43a8 (patch)
treee866789872707043674fea78fe5c944e2e3491ec /ui/jquery.ui.accordion.js
parent84a4a4442d25631bd00b50d48ff2d57a6089f6d3 (diff)
downloadjquery-ui-f70f01af9ea1d1d191b77fab6dadbbe421be43a8.tar.gz
jquery-ui-f70f01af9ea1d1d191b77fab6dadbbe421be43a8.zip
Accordion: Handle changing the event option. Fixes #6740 - Dynamically changing accordion's event handler doesn't actually change the behaviour.
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r--ui/jquery.ui.accordion.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 1c30ba89b..8049868e8 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -96,10 +96,7 @@ $.widget( "ui.accordion", {
self.headers.find( "a" ).attr( "tabIndex", -1 );
}
- if ( options.event ) {
- self.headers.bind( options.event.split( " " ).join( ".accordion " ) + ".accordion",
- $.proxy( self, "_eventHandler" ) );
- }
+ this._setupEvents( options.event );
},
_createIcons: function() {
@@ -164,6 +161,10 @@ $.widget( "ui.accordion", {
this._activate( 0 );
}
+ if ( key === "event" ) {
+ this._setupEvents( value );
+ }
+
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
@@ -284,6 +285,14 @@ $.widget( "ui.accordion", {
return typeof selector === "number" ? this.headers.eq( selector ) : $();
},
+ _setupEvents: function( event ) {
+ this.headers.unbind( ".accordion" );
+ if ( event ) {
+ this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion",
+ $.proxy( this, "_eventHandler" ) );
+ }
+ },
+
_eventHandler: function( event ) {
var options = this.options,
active = this.active,