@@ -56,8 +56,7 @@ $.widget( "ui.accordion", {
56
56
}
57
57
this . active = this . _findActive ( options . active )
58
58
. addClass ( "ui-accordion-header-active ui-state-active" )
59
- . toggleClass ( "ui-corner-all" )
60
- . toggleClass ( "ui-corner-top" ) ;
59
+ . toggleClass ( "ui-corner-all ui-corner-top" )
61
60
this . active . next ( ) . addClass ( "ui-accordion-content-active" ) ;
62
61
63
62
this . _createIcons ( ) ;
@@ -69,13 +68,15 @@ $.widget( "ui.accordion", {
69
68
70
69
this . headers
71
70
. attr ( "role" , "tab" )
71
+ // TODO: use _bind()
72
72
. bind ( "keydown.accordion" , $ . proxy ( this , "_keydown" ) )
73
73
. next ( )
74
74
. attr ( "role" , "tabpanel" ) ;
75
75
76
76
this . headers
77
77
. not ( this . active )
78
78
. attr ( {
79
+ // TODO: document support for each of these
79
80
"aria-expanded" : "false" ,
80
81
"aria-selected" : "false" ,
81
82
tabIndex : - 1
@@ -137,9 +138,7 @@ $.widget( "ui.accordion", {
137
138
. removeAttr ( "role" )
138
139
. removeAttr ( "aria-expanded" )
139
140
. removeAttr ( "aria-selected" )
140
- . removeAttr ( "tabIndex" )
141
- . find ( "a" )
142
- . removeAttr ( "tabIndex" )
141
+ . removeAttr ( "tabIndex" ) ;
143
142
this . _destroyIcons ( ) ;
144
143
145
144
// clean up content panels
@@ -162,6 +161,7 @@ $.widget( "ui.accordion", {
162
161
163
162
if ( key === "event" ) {
164
163
if ( this . options . event ) {
164
+ // TODO: this is incorrect for multiple events (see _setupEvents)
165
165
this . headers . unbind ( this . options . event + ".accordion" , this . _eventHandler ) ;
166
166
}
167
167
this . _setupEvents ( value ) ;
@@ -184,12 +184,15 @@ $.widget( "ui.accordion", {
184
184
// #5332 - opacity doesn't cascade to positioned elements in IE
185
185
// so we need to add the disabled class to the headers and panels
186
186
if ( key === "disabled" ) {
187
- this . headers . add ( this . headers . next ( ) )
187
+ this . headers . add ( this . headers . next ( ) )
188
+ // TODO: why do we have an accordion-specific disabled class?
189
+ // widget-specific classes seem to exist in a lot of plugins
188
190
. toggleClass ( "ui-accordion-disabled ui-state-disabled" , ! ! value ) ;
189
191
}
190
192
} ,
191
193
192
194
_keydown : function ( event ) {
195
+ // TODO: remove disabled check when using _bind()
193
196
if ( this . options . disabled || event . altKey || event . ctrlKey ) {
194
197
return ;
195
198
}
@@ -300,6 +303,7 @@ $.widget( "ui.accordion", {
300
303
301
304
_setupEvents : function ( event ) {
302
305
if ( event ) {
306
+ // TODO: use _bind()
303
307
this . headers . bind ( event . split ( " " ) . join ( ".accordion " ) + ".accordion" ,
304
308
$ . proxy ( this , "_eventHandler" ) ) ;
305
309
}
@@ -377,7 +381,7 @@ $.widget( "ui.accordion", {
377
381
} else {
378
382
toHide . hide ( ) ;
379
383
toShow . show ( ) ;
380
- this . _completed ( data ) ;
384
+ this . _toggleComplete ( data ) ;
381
385
}
382
386
383
387
// TODO assert that the blur and focus triggers are really necessary, remove otherwise
@@ -406,7 +410,7 @@ $.widget( "ui.accordion", {
406
410
options = down && animate . down || animate ,
407
411
complete = function ( ) {
408
412
toShow . removeData ( "ui-accordion-height" ) ;
409
- that . _completed ( data ) ;
413
+ that . _toggleComplete ( data ) ;
410
414
} ;
411
415
412
416
if ( typeof options === "number" ) {
@@ -438,7 +442,7 @@ $.widget( "ui.accordion", {
438
442
duration , easing , complete ) ;
439
443
} ,
440
444
441
- _completed : function ( data ) {
445
+ _toggleComplete : function ( data ) {
442
446
var toShow = data . newContent ,
443
447
toHide = data . oldContent ;
444
448
0 commit comments