.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
this._hoverable( this.headers );
this._focusable( this.headers );
- this._bind( this.headers, {
- keydown: "_keydown"
- });
this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
}
this.active = this._findActive( options.active )
.addClass( "ui-accordion-header-active ui-state-active" )
- .toggleClass( "ui-corner-all ui-corner-top" )
+ .toggleClass( "ui-corner-all ui-corner-top" );
this.active.next().addClass( "ui-accordion-content-active" );
this._createIcons();
if ( key === "event" ) {
if ( this.options.event ) {
- this.headers.unbind( this.options.event.split( " " ).join( ".accordion " ) + ".accordion", this._eventHandler );
+ this.headers.unbind( ".accordion" );
}
this._setupEvents( value );
}
},
_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 ) {
event.preventDefault();
- if ( options.disabled ||
+ if (
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation