@@ -33,19 +33,18 @@ $.widget( "ui.accordion", {
33
33
} ,
34
34
35
35
_create : function ( ) {
36
- var self = this ,
37
- options = self . options ;
36
+ var options = this . options ;
38
37
39
- self . lastToggle = { } ;
40
- self . element . addClass ( "ui-accordion ui-widget ui-helper-reset" ) ;
38
+ this . lastToggle = { } ;
39
+ this . element . addClass ( "ui-accordion ui-widget ui-helper-reset" ) ;
41
40
42
- self . headers = self . element . find ( options . header )
41
+ this . headers = this . element . find ( options . header )
43
42
. addClass ( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) ;
44
- self . _hoverable ( self . headers ) ;
45
- self . _focusable ( self . headers ) ;
46
- self . headers . find ( ":first-child" ) . addClass ( "ui-accordion-heading" ) ;
43
+ this . _hoverable ( this . headers ) ;
44
+ this . _focusable ( this . headers ) ;
45
+ this . headers . find ( ":first-child" ) . addClass ( "ui-accordion-heading" ) ;
47
46
48
- self . headers . next ( )
47
+ this . headers . next ( )
49
48
. addClass ( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) ;
50
49
51
50
// don't allow collapsible: false and active: false
@@ -56,26 +55,26 @@ $.widget( "ui.accordion", {
56
55
if ( options . active < 0 ) {
57
56
options . active += this . headers . length ;
58
57
}
59
- self . active = self . _findActive ( options . active )
58
+ this . active = this . _findActive ( options . active )
60
59
. addClass ( "ui-accordion-header-active ui-state-active" )
61
60
. toggleClass ( "ui-corner-all" )
62
61
. toggleClass ( "ui-corner-top" ) ;
63
- self . active . next ( ) . addClass ( "ui-accordion-content-active" ) ;
62
+ this . active . next ( ) . addClass ( "ui-accordion-content-active" ) ;
64
63
65
- self . _createIcons ( ) ;
66
- self . refresh ( ) ;
64
+ this . _createIcons ( ) ;
65
+ this . refresh ( ) ;
67
66
68
67
// ARIA
69
- self . element . attr ( "role" , "tablist" ) ;
68
+ this . element . attr ( "role" , "tablist" ) ;
70
69
71
- self . headers
70
+ this . headers
72
71
. attr ( "role" , "tab" )
73
- . bind ( "keydown.accordion" , $ . proxy ( self , "_keydown" ) )
72
+ . bind ( "keydown.accordion" , $ . proxy ( this , "_keydown" ) )
74
73
. next ( )
75
74
. attr ( "role" , "tabpanel" ) ;
76
75
77
- self . headers
78
- . not ( self . active )
76
+ this . headers
77
+ . not ( this . active )
79
78
. attr ( {
80
79
"aria-expanded" : "false" ,
81
80
"aria-selected" : "false" ,
@@ -85,10 +84,10 @@ $.widget( "ui.accordion", {
85
84
. hide ( ) ;
86
85
87
86
// make sure at least one header is in the tab order
88
- if ( ! self . active . length ) {
89
- self . headers . eq ( 0 ) . attr ( "tabIndex" , 0 ) ;
87
+ if ( ! this . active . length ) {
88
+ this . headers . eq ( 0 ) . attr ( "tabIndex" , 0 ) ;
90
89
} else {
91
- self . active . attr ( {
90
+ this . active . attr ( {
92
91
"aria-expanded" : "true" ,
93
92
"aria-selected" : "true" ,
94
93
tabIndex : 0
@@ -97,7 +96,7 @@ $.widget( "ui.accordion", {
97
96
98
97
// only need links in tab order for Safari
99
98
if ( ! $ . browser . safari ) {
100
- self . headers . find ( "a" ) . attr ( "tabIndex" , - 1 ) ;
99
+ this . headers . find ( "a" ) . attr ( "tabIndex" , - 1 ) ;
101
100
}
102
101
103
102
this . _setupEvents ( options . event ) ;
@@ -362,13 +361,13 @@ $.widget( "ui.accordion", {
362
361
} ,
363
362
364
363
_toggle : function ( data ) {
365
- var self = this ,
366
- options = self . options ,
364
+ var that = this ,
365
+ options = this . options ,
367
366
toShow = data . newContent ,
368
367
toHide = data . oldContent ;
369
368
370
369
function complete ( ) {
371
- self . _completed ( data ) ;
370
+ that . _completed ( data ) ;
372
371
}
373
372
374
373
if ( options . animated ) {
@@ -385,11 +384,11 @@ $.widget( "ui.accordion", {
385
384
}
386
385
387
386
animations [ animation ] ( {
388
- widget : self ,
387
+ widget : this ,
389
388
toShow : toShow ,
390
389
toHide : toHide ,
391
- prevShow : self . lastToggle . toShow ,
392
- prevHide : self . lastToggle . toHide ,
390
+ prevShow : this . lastToggle . toShow ,
391
+ prevHide : this . lastToggle . toHide ,
393
392
complete : complete ,
394
393
down : toShow . length && ( ! toHide . length || ( toShow . index ( ) < toHide . index ( ) ) )
395
394
} , additional ) ;
@@ -572,7 +571,7 @@ if ( $.uiBackCompat !== false ) {
572
571
var _create = prototype . _create ;
573
572
prototype . _create = function ( ) {
574
573
if ( this . options . navigation ) {
575
- var self = this ,
574
+ var that = this ,
576
575
headers = this . element . find ( this . options . header ) ,
577
576
content = headers . next ( ) ,
578
577
current = headers . add ( content )
@@ -582,7 +581,7 @@ if ( $.uiBackCompat !== false ) {
582
581
if ( current ) {
583
582
headers . add ( content ) . each ( function ( index ) {
584
583
if ( $ . contains ( this , current ) ) {
585
- self . options . active = Math . floor ( index / 2 ) ;
584
+ that . options . active = Math . floor ( index / 2 ) ;
586
585
return false ;
587
586
}
588
587
} ) ;
0 commit comments