diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-03-18 15:46:11 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-03-18 15:46:11 +0100 |
commit | 6de8030f014eaa298543feea15960848d2f0d029 (patch) | |
tree | 650be3497d98b58e61a4770c13c3cee7e5a1f848 /ui/jquery.ui.accordion.js | |
parent | 5c53dd1bbc0cb0897d4851bad77c3fe22fda27dc (diff) | |
parent | 17db755a4f04dfc7b0be8d9a5c290cc5bc48e08e (diff) | |
download | jquery-ui-6de8030f014eaa298543feea15960848d2f0d029.tar.gz jquery-ui-6de8030f014eaa298543feea15960848d2f0d029.zip |
Merge branch 'accordion-cleanup'
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r-- | ui/jquery.ui.accordion.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 169a07409..2200732ac 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -68,8 +68,6 @@ $.widget( "ui.accordion", { this.headers .attr( "role", "tab" ) - // TODO: use _bind() - .bind( "keydown.accordion", $.proxy( this, "_keydown" ) ) .next() .attr( "role", "tabpanel" ); @@ -161,8 +159,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( ".accordion" ); } this._setupEvents( value ); } @@ -190,8 +187,7 @@ $.widget( "ui.accordion", { }, _keydown: function( event ) { - // TODO: remove disabled check when using _bind() - if ( this.options.disabled || event.altKey || event.ctrlKey ) { + if ( event.altKey || event.ctrlKey ) { return; } @@ -300,11 +296,15 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { + var events = { + keydown: "_keydown" + }; if ( event ) { - // TODO: use _bind() - this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion", - $.proxy( this, "_eventHandler" ) ); + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); } + this._bind( this.headers, events ); }, _eventHandler: function( event ) { @@ -324,7 +324,7 @@ $.widget( "ui.accordion", { event.preventDefault(); - if ( options.disabled || + if ( // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation |