Skip to content

Commit 6ed30a6

Browse files
jzaeffererarschmitz
authored andcommitted
Controlgroup: Convert to onevar, fix guard-clause/else, rm tmp var
1 parent b61a3c7 commit 6ed30a6

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

ui/widgets/controlgroup.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ return $.widget( "ui.controlgroup", {
6969

7070
// First we iterate over each of the items options
7171
$.each( this.options.items, function( widget, selector ) {
72-
var widgets, labels,
73-
options = {};
72+
var labels;
73+
var options = {};
7474

7575
// Make sure the widget actually exists and has a selector set
7676
if ( !$.fn[ widget ] || !selector ) {
7777
return;
78-
} else if ( selector && widget === "controlgroupLabel" ) {
78+
}
79+
80+
if ( widget === "controlgroupLabel" ) {
7981
labels = that.element.find( selector );
8082
labels.each( function() {
8183
$( this ).contents().wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
@@ -92,19 +94,19 @@ return $.widget( "ui.controlgroup", {
9294
}
9395

9496
// Find instances of this widget inside controlgroup and init them
95-
widgets = that.element.find( selector )[ widget ]( options );
96-
97-
widgets.each( function() {
98-
var element = $( this );
99-
100-
// Store an instance of the controlgroup to be able to reference
101-
// from the outermost element for changing options and refresh
102-
var widgetElement = element[ widget ]( "widget" );
103-
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
104-
element[ widget ]( "instance" ) );
105-
106-
childWidgets.push( widgetElement[ 0 ] );
107-
} );
97+
that.element
98+
.find( selector )[ widget ]( options )
99+
.each( function() {
100+
var element = $( this );
101+
102+
// Store an instance of the controlgroup to be able to reference
103+
// from the outermost element for changing options and refresh
104+
var widgetElement = element[ widget ]( "widget" );
105+
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
106+
element[ widget ]( "instance" ) );
107+
108+
childWidgets.push( widgetElement[ 0 ] );
109+
} );
108110
} );
109111

110112
this.childWidgets = $( $.unique( childWidgets ) );

0 commit comments

Comments
 (0)