1616//>>css.structure: ../themes/base/accordion.css
1717//>>css.theme: ../themes/base/theme.css
1818
19- ( function ( factory ) {
19+ ( function ( factory ) {
2020if ( typeof define === "function" && define . amd ) {
2121
2222// AMD. Register as an anonymous module.
23- define ( [
23+ define ( [
2424"jquery" ,
2525"./core" ,
2626"./widget"
3030// Browser globals
3131factory ( jQuery ) ;
3232}
33- } ( function ( $ ) {
33+ } ( function ( $ ) {
3434
3535return $ . widget ( "ui.accordion" , {
3636version : "@VERSION" ,
@@ -80,7 +80,7 @@ return $.widget( "ui.accordion", {
8080this . element . attr ( "role" , "tablist" ) ;
8181
8282// don't allow collapsible: false and active: false / null
83- if ( ! options . collapsible && ( options . active === false || options . active == null ) ) {
83+ if ( ! options . collapsible && ( options . active === false || options . active == null ) ) {
8484options . active = 0 ;
8585}
8686
@@ -200,24 +200,24 @@ return $.widget( "ui.accordion", {
200200toFocus = false ;
201201
202202switch ( event . keyCode ) {
203- case keyCode . RIGHT :
204- case keyCode . DOWN :
205- toFocus = this . headers [ ( currentIndex + 1 ) % length ] ;
206- break ;
207- case keyCode . LEFT :
208- case keyCode . UP :
209- toFocus = this . headers [ ( currentIndex - 1 + length ) % length ] ;
210- break ;
211- case keyCode . SPACE :
212- case keyCode . ENTER :
213- this . _eventHandler ( event ) ;
214- break ;
215- case keyCode . HOME :
216- toFocus = this . headers [ 0 ] ;
217- break ;
218- case keyCode . END :
219- toFocus = this . headers [ length - 1 ] ;
220- break ;
203+ case keyCode . RIGHT :
204+ case keyCode . DOWN :
205+ toFocus = this . headers [ ( currentIndex + 1 ) % length ] ;
206+ break ;
207+ case keyCode . LEFT :
208+ case keyCode . UP :
209+ toFocus = this . headers [ ( currentIndex - 1 + length ) % length ] ;
210+ break ;
211+ case keyCode . SPACE :
212+ case keyCode . ENTER :
213+ this . _eventHandler ( event ) ;
214+ break ;
215+ case keyCode . HOME :
216+ toFocus = this . headers [ 0 ] ;
217+ break ;
218+ case keyCode . END :
219+ toFocus = this . headers [ length - 1 ] ;
220+ break ;
221221}
222222
223223if ( toFocus ) {
@@ -248,7 +248,7 @@ return $.widget( "ui.accordion", {
248248// was active, but active panel is gone
249249} else if ( this . active . length && ! $ . contains ( this . element [ 0 ] , this . active [ 0 ] ) ) {
250250// all remaining panel are disabled
251- if ( this . headers . length === this . headers . find ( ".ui-state-disabled" ) . length ) {
251+ if ( this . headers . length === this . headers . find ( ".ui-state-disabled" ) . length ) {
252252options . active = false ;
253253this . active = $ ( ) ;
254254// activate previous panel
@@ -298,43 +298,43 @@ return $.widget( "ui.accordion", {
298298
299299this . headers
300300. attr ( "role" , "tab" )
301- . each ( function ( ) {
301+ . each ( function ( ) {
302302var header = $ ( this ) ,
303303headerId = header . uniqueId ( ) . attr ( "id" ) ,
304304panel = header . next ( ) ,
305305panelId = panel . uniqueId ( ) . attr ( "id" ) ;
306306header . attr ( "aria-controls" , panelId ) ;
307307panel . attr ( "aria-labelledby" , headerId ) ;
308- } )
308+ } )
309309. next ( )
310310. attr ( "role" , "tabpanel" ) ;
311311
312312this . headers
313313. not ( this . active )
314- . attr ( {
315- "aria-selected" : "false" ,
316- "aria-expanded" : "false" ,
317- tabIndex : - 1
318- } )
319- . next ( )
320- . attr ( {
321- "aria-hidden" : "true"
322- } )
323- . hide ( ) ;
314+ . attr ( {
315+ "aria-selected" : "false" ,
316+ "aria-expanded" : "false" ,
317+ tabIndex : - 1
318+ } )
319+ . next ( )
320+ . attr ( {
321+ "aria-hidden" : "true"
322+ } )
323+ . hide ( ) ;
324324
325325// make sure at least one header is in the tab order
326326if ( ! this . active . length ) {
327327this . headers . eq ( 0 ) . attr ( "tabIndex" , 0 ) ;
328328} else {
329- this . active . attr ( {
329+ this . active . attr ( {
330330"aria-selected" : "true" ,
331331"aria-expanded" : "true" ,
332332tabIndex : 0
333- } )
334- . next ( )
335- . attr ( {
336- "aria-hidden" : "false"
337- } ) ;
333+ } )
334+ . next ( )
335+ . attr ( {
336+ "aria-hidden" : "false"
337+ } ) ;
338338}
339339
340340this . _createIcons ( ) ;
@@ -343,32 +343,32 @@ return $.widget( "ui.accordion", {
343343
344344if ( heightStyle === "fill" ) {
345345maxHeight = parent . height ( ) ;
346- this . element . siblings ( ":visible" ) . each ( function ( ) {
346+ this . element . siblings ( ":visible" ) . each ( function ( ) {
347347var elem = $ ( this ) ,
348348position = elem . css ( "position" ) ;
349349
350350if ( position === "absolute" || position === "fixed" ) {
351351return ;
352352}
353353maxHeight -= elem . outerHeight ( true ) ;
354- } ) ;
354+ } ) ;
355355
356- this . headers . each ( function ( ) {
356+ this . headers . each ( function ( ) {
357357maxHeight -= $ ( this ) . outerHeight ( true ) ;
358- } ) ;
358+ } ) ;
359359
360360this . headers . next ( )
361- . each ( function ( ) {
361+ . each ( function ( ) {
362362$ ( this ) . height ( Math . max ( 0 , maxHeight -
363363$ ( this ) . innerHeight ( ) + $ ( this ) . height ( ) ) ) ;
364- } )
364+ } )
365365. css ( "overflow" , "auto" ) ;
366366} else if ( heightStyle === "auto" ) {
367367maxHeight = 0 ;
368368this . headers . next ( )
369- . each ( function ( ) {
369+ . each ( function ( ) {
370370maxHeight = Math . max ( maxHeight , $ ( this ) . css ( "height" , "" ) . height ( ) ) ;
371- } )
371+ } )
372372. height ( maxHeight ) ;
373373}
374374} ,
@@ -384,11 +384,11 @@ return $.widget( "ui.accordion", {
384384// trying to collapse, simulate a click on the currently active header
385385active = active || this . active [ 0 ] ;
386386
387- this . _eventHandler ( {
387+ this . _eventHandler ( {
388388target : active ,
389389currentTarget : active ,
390390preventDefault : $ . noop
391- } ) ;
391+ } ) ;
392392} ,
393393
394394_findActive : function ( selector ) {
@@ -402,12 +402,12 @@ return $.widget( "ui.accordion", {
402402if ( event ) {
403403$ . each ( event . split ( " " ) , function ( index , eventName ) {
404404events [ eventName ] = "_eventHandler" ;
405- } ) ;
405+ } ) ;
406406}
407407
408408this . _off ( this . headers . add ( this . headers . next ( ) ) ) ;
409409this . _on ( this . headers , events ) ;
410- this . _on ( this . headers . next ( ) , { keydown : "_panelKeyDown" } ) ;
410+ this . _on ( this . headers . next ( ) , { keydown : "_panelKeyDown" } ) ;
411411this . _hoverable ( this . headers ) ;
412412this . _focusable ( this . headers ) ;
413413} ,
@@ -484,36 +484,36 @@ return $.widget( "ui.accordion", {
484484this . _toggleComplete ( data ) ;
485485}
486486
487- toHide . attr ( {
487+ toHide . attr ( {
488488"aria-hidden" : "true"
489- } ) ;
490- toHide . prev ( ) . attr ( {
489+ } ) ;
490+ toHide . prev ( ) . attr ( {
491491"aria-selected" : "false" ,
492492"aria-expanded" : "false"
493- } ) ;
493+ } ) ;
494494// if we're switching panels, remove the old header from the tab order
495495// if we're opening from collapsed state, remove the previous header from the tab order
496496// if we're collapsing, then keep the collapsing header in the tab order
497497if ( toShow . length && toHide . length ) {
498- toHide . prev ( ) . attr ( {
498+ toHide . prev ( ) . attr ( {
499499"tabIndex" : - 1 ,
500500"aria-expanded" : "false"
501- } ) ;
501+ } ) ;
502502} else if ( toShow . length ) {
503- this . headers . filter ( function ( ) {
503+ this . headers . filter ( function ( ) {
504504return parseInt ( $ ( this ) . attr ( "tabIndex" ) , 10 ) === 0 ;
505- } )
506- . attr ( "tabIndex" , - 1 ) ;
505+ } )
506+ . attr ( "tabIndex" , - 1 ) ;
507507}
508508
509509toShow
510510. attr ( "aria-hidden" , "false" )
511511. prev ( )
512- . attr ( {
512+ . attr ( {
513513"aria-selected" : "true" ,
514514"aria-expanded" : "true" ,
515515tabIndex : 0
516- } ) ;
516+ } ) ;
517517} ,
518518
519519_animate : function ( toShow , toHide , data ) {
@@ -553,7 +553,7 @@ return $.widget( "ui.accordion", {
553553step : function ( now , fx ) {
554554fx . now = Math . round ( now ) ;
555555}
556- } ) ;
556+ } ) ;
557557toShow
558558. hide ( )
559559. animate ( this . showProps , {
@@ -571,7 +571,7 @@ return $.widget( "ui.accordion", {
571571adjust = 0 ;
572572}
573573}
574- } ) ;
574+ } ) ;
575575} ,
576576
577577_toggleComplete : function ( data ) {
@@ -588,6 +588,6 @@ return $.widget( "ui.accordion", {
588588}
589589this . _trigger ( "activate" , null , data ) ;
590590}
591- } ) ;
591+ } ) ;
592592
593- } ) ) ;
593+ } ) ) ;
0 commit comments