@@ -338,8 +338,26 @@ $.widget( "ui.accordion", {
338
338
return ;
339
339
}
340
340
341
+ // find elements to show and hide
342
+ var active = this . active ,
343
+ toShow = clicked . next ( ) ,
344
+ toHide = this . active . next ( ) ,
345
+ data = {
346
+ options : options ,
347
+ newHeader : clickedIsActive && options . collapsible ? $ ( [ ] ) : clicked ,
348
+ oldHeader : this . active ,
349
+ newContent : clickedIsActive && options . collapsible ? $ ( [ ] ) : toShow ,
350
+ oldContent : toHide
351
+ } ,
352
+ down = this . headers . index ( this . active [ 0 ] ) > this . headers . index ( clicked [ 0 ] ) ;
353
+
354
+ // when the call to ._toggle() comes after the class changes
355
+ // it causes a very odd bug in IE 8 (see #6720)
356
+ this . active = clickedIsActive ? $ ( [ ] ) : clicked ;
357
+ this . _toggle ( toShow , toHide , data , clickedIsActive , down ) ;
358
+
341
359
// switch classes
342
- this . active
360
+ active
343
361
. removeClass ( "ui-state-active ui-corner-top" )
344
362
. addClass ( "ui-state-default ui-corner-all" )
345
363
. children ( ".ui-icon" )
@@ -357,21 +375,6 @@ $.widget( "ui.accordion", {
357
375
. addClass ( "ui-accordion-content-active" ) ;
358
376
}
359
377
360
- // find elements to show and hide
361
- var toShow = clicked . next ( ) ,
362
- toHide = this . active . next ( ) ,
363
- data = {
364
- options : options ,
365
- newHeader : clickedIsActive && options . collapsible ? $ ( [ ] ) : clicked ,
366
- oldHeader : this . active ,
367
- newContent : clickedIsActive && options . collapsible ? $ ( [ ] ) : toShow ,
368
- oldContent : toHide
369
- } ,
370
- down = this . headers . index ( this . active [ 0 ] ) > this . headers . index ( clicked [ 0 ] ) ;
371
-
372
- this . active = clickedIsActive ? $ ( [ ] ) : clicked ;
373
- this . _toggle ( toShow , toHide , data , clickedIsActive , down ) ;
374
-
375
378
return ;
376
379
} ,
377
380
0 commit comments