diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-03-27 16:49:05 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-03-27 16:49:05 -0400 |
commit | 6634e4005368ded31dce50de7095ed0f8835637c (patch) | |
tree | 97699ae373c51e12e1539cba09cbe213a9eaa5b5 /ui | |
parent | a709943a8b6ce83ae258e1532c2dfc6a39d27fc2 (diff) | |
download | jquery-ui-6634e4005368ded31dce50de7095ed0f8835637c.tar.gz jquery-ui-6634e4005368ded31dce50de7095ed0f8835637c.zip |
Accordion: Fixed post-init changes to event option and added tests for keyboard support.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.accordion.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 2e68889ef..ba8fa5e44 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -118,6 +118,8 @@ $.widget( "ui.accordion", { }); } + this._bind( this.headers, { keydown: "_keydown" }); + this._bind( this.headers.next(), { keydown: "_panelKeyDown" }); this._setupEvents( options.event ); }, @@ -198,7 +200,8 @@ $.widget( "ui.accordion", { if ( key === "event" ) { if ( this.options.event ) { - this.headers.unbind( ".accordion" ); + this.headers.unbind( + this.options.event.split( " " ).join( ".accordion " ) + ".accordion" ); } this._setupEvents( value ); } @@ -348,18 +351,14 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { - var events = { - keydown: "_keydown" - }; - if ( event ) { - $.each( event.split(" "), function( index, eventName ) { - events[ eventName ] = "_eventHandler"; - }); + var events = {}; + if ( !event ) { + return; } - this._bind( this.headers, events ); - this._bind( this.headers.next(), { - keydown: "_panelKeyDown" + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; }); + this._bind( this.headers, events ); }, _eventHandler: function( event ) { |