@@ -37,13 +37,12 @@ $.widget( "ui.accordion", {
37
37
38
38
self . headers = self . element . find ( options . header )
39
39
. addClass ( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) ;
40
-
41
40
self . _hoverable ( self . headers ) ;
42
41
self . _focusable ( self . headers ) ;
43
-
42
+ self . headers . find ( ":first-child" ) . addClass ( "ui-accordion-heading" ) ;
43
+
44
44
self . headers . next ( )
45
45
. addClass ( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) ;
46
- self . headers . find ( ":first-child" ) . addClass ( "ui-accordion-heading" ) ;
47
46
48
47
self . active = self . _findActive ( options . active )
49
48
. addClass ( "ui-state-default ui-state-active" )
@@ -53,7 +52,7 @@ $.widget( "ui.accordion", {
53
52
54
53
self . _createIcons ( ) ;
55
54
self . refresh ( ) ;
56
-
55
+
57
56
// ARIA
58
57
self . element . attr ( "role" , "tablist" ) ;
59
58
@@ -64,7 +63,7 @@ $.widget( "ui.accordion", {
64
63
. attr ( "role" , "tabpanel" ) ;
65
64
66
65
self . headers
67
- . not ( self . active || "" )
66
+ . not ( self . active )
68
67
. attr ( {
69
68
"aria-expanded" : "false" ,
70
69
tabIndex : - 1
@@ -89,7 +88,7 @@ $.widget( "ui.accordion", {
89
88
}
90
89
91
90
if ( options . event ) {
92
- self . headers . bind ( options . event . split ( " " ) . join ( ".accordion " ) + ".accordion" ,
91
+ self . headers . bind ( options . event . split ( " " ) . join ( ".accordion " ) + ".accordion" ,
93
92
$ . proxy ( self , "_eventHandler" ) ) ;
94
93
}
95
94
} ,
@@ -124,11 +123,14 @@ $.widget( "ui.accordion", {
124
123
. removeClass ( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
125
124
. removeAttr ( "role" )
126
125
. removeAttr ( "aria-expanded" )
127
- . removeAttr ( "tabIndex" ) ;
128
-
129
- this . headers . find ( "a" ) . removeAttr ( "tabIndex" ) ;
126
+ . removeAttr ( "tabIndex" )
127
+ . find ( "a" )
128
+ . removeAttr ( "tabIndex" )
129
+ . end ( )
130
+ . find ( ".ui-accordion-heading" )
131
+ . removeClass ( "ui-accordion-heading" ) ;
130
132
this . _destroyIcons ( ) ;
131
- this . headers . find ( "a:first-child" ) . removeClass ( "ui-accordion-heading" ) ;
133
+
132
134
var contents = this . headers . next ( )
133
135
. css ( "display" , "" )
134
136
. removeAttr ( "role" )
@@ -139,23 +141,23 @@ $.widget( "ui.accordion", {
139
141
} ,
140
142
141
143
_setOption : function ( key , value ) {
142
- if ( key == "active" ) {
144
+ if ( key === "active" ) {
143
145
// _activate() will handle invalid values and update this.options
144
146
this . _activate ( value ) ;
145
147
return ;
146
148
}
147
-
149
+
148
150
this . _super ( "_setOption" , key , value ) ;
149
-
150
- if ( key == "icons" ) {
151
+
152
+ if ( key === "icons" ) {
151
153
this . _destroyIcons ( ) ;
152
154
if ( value ) {
153
155
this . _createIcons ( ) ;
154
156
}
155
157
}
156
158
// #5332 - opacity doesn't cascade to positioned elements in IE
157
159
// so we need to add the disabled class to the headers and panels
158
- if ( key == "disabled" ) {
160
+ if ( key === "disabled" ) {
159
161
this . headers . add ( this . headers . next ( ) )
160
162
. toggleClass ( "ui-accordion-disabled ui-state-disabled" , ! ! value ) ;
161
163
}
0 commit comments