Skip to content

Commit 1e266bb

Browse files
committed
Accordion: Fix style issues
Closes jquerygh-1495
1 parent b99f5b3 commit 1e266bb

File tree

1 file changed

+68
-68
lines changed

1 file changed

+68
-68
lines changed

ui/accordion.js

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
//>>css.structure: ../themes/base/accordion.css
1717
//>>css.theme: ../themes/base/theme.css
1818

19-
(function( factory ) {
19+
( function( factory ) {
2020
if ( typeof define === "function" && define.amd ) {
2121

2222
// AMD. Register as an anonymous module.
23-
define([
23+
define( [
2424
"jquery",
2525
"./core",
2626
"./widget"
@@ -30,7 +30,7 @@
3030
// Browser globals
3131
factory( jQuery );
3232
}
33-
}(function( $ ) {
33+
}( function( $ ) {
3434

3535
return $.widget( "ui.accordion", {
3636
version: "@VERSION",
@@ -80,7 +80,7 @@ return $.widget( "ui.accordion", {
8080
this.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 ) ) {
8484
options.active = 0;
8585
}
8686

@@ -200,24 +200,24 @@ return $.widget( "ui.accordion", {
200200
toFocus = false;
201201

202202
switch ( 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

223223
if ( 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 ) {
252252
options.active = false;
253253
this.active = $();
254254
// activate previous panel
@@ -298,43 +298,43 @@ return $.widget( "ui.accordion", {
298298

299299
this.headers
300300
.attr( "role", "tab" )
301-
.each(function() {
301+
.each( function() {
302302
var header = $( this ),
303303
headerId = header.uniqueId().attr( "id" ),
304304
panel = header.next(),
305305
panelId = panel.uniqueId().attr( "id" );
306306
header.attr( "aria-controls", panelId );
307307
panel.attr( "aria-labelledby", headerId );
308-
})
308+
} )
309309
.next()
310310
.attr( "role", "tabpanel" );
311311

312312
this.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
326326
if ( !this.active.length ) {
327327
this.headers.eq( 0 ).attr( "tabIndex", 0 );
328328
} else {
329-
this.active.attr({
329+
this.active.attr( {
330330
"aria-selected": "true",
331331
"aria-expanded": "true",
332332
tabIndex: 0
333-
})
334-
.next()
335-
.attr({
336-
"aria-hidden": "false"
337-
});
333+
} )
334+
.next()
335+
.attr( {
336+
"aria-hidden": "false"
337+
} );
338338
}
339339

340340
this._createIcons();
@@ -343,32 +343,32 @@ return $.widget( "ui.accordion", {
343343

344344
if ( heightStyle === "fill" ) {
345345
maxHeight = parent.height();
346-
this.element.siblings( ":visible" ).each(function() {
346+
this.element.siblings( ":visible" ).each( function() {
347347
var elem = $( this ),
348348
position = elem.css( "position" );
349349

350350
if ( position === "absolute" || position === "fixed" ) {
351351
return;
352352
}
353353
maxHeight -= elem.outerHeight( true );
354-
});
354+
} );
355355

356-
this.headers.each(function() {
356+
this.headers.each( function() {
357357
maxHeight -= $( this ).outerHeight( true );
358-
});
358+
} );
359359

360360
this.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" ) {
367367
maxHeight = 0;
368368
this.headers.next()
369-
.each(function() {
369+
.each( function() {
370370
maxHeight = 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
385385
active = active || this.active[ 0 ];
386386

387-
this._eventHandler({
387+
this._eventHandler( {
388388
target: active,
389389
currentTarget: active,
390390
preventDefault: $.noop
391-
});
391+
} );
392392
},
393393

394394
_findActive: function( selector ) {
@@ -402,12 +402,12 @@ return $.widget( "ui.accordion", {
402402
if ( event ) {
403403
$.each( event.split( " " ), function( index, eventName ) {
404404
events[ eventName ] = "_eventHandler";
405-
});
405+
} );
406406
}
407407

408408
this._off( this.headers.add( this.headers.next() ) );
409409
this._on( this.headers, events );
410-
this._on( this.headers.next(), { keydown: "_panelKeyDown" });
410+
this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
411411
this._hoverable( this.headers );
412412
this._focusable( this.headers );
413413
},
@@ -484,36 +484,36 @@ return $.widget( "ui.accordion", {
484484
this._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
497497
if ( 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() {
504504
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
505-
})
506-
.attr( "tabIndex", -1 );
505+
} )
506+
.attr( "tabIndex", -1 );
507507
}
508508

509509
toShow
510510
.attr( "aria-hidden", "false" )
511511
.prev()
512-
.attr({
512+
.attr( {
513513
"aria-selected": "true",
514514
"aria-expanded": "true",
515515
tabIndex: 0
516-
});
516+
} );
517517
},
518518

519519
_animate: function( toShow, toHide, data ) {
@@ -553,7 +553,7 @@ return $.widget( "ui.accordion", {
553553
step: function( now, fx ) {
554554
fx.now = Math.round( now );
555555
}
556-
});
556+
} );
557557
toShow
558558
.hide()
559559
.animate( this.showProps, {
@@ -571,7 +571,7 @@ return $.widget( "ui.accordion", {
571571
adjust = 0;
572572
}
573573
}
574-
});
574+
} );
575575
},
576576

577577
_toggleComplete: function( data ) {
@@ -588,6 +588,6 @@ return $.widget( "ui.accordion", {
588588
}
589589
this._trigger( "activate", null, data );
590590
}
591-
});
591+
} );
592592

593-
}));
593+
} ) );

0 commit comments

Comments
 (0)