aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2015-10-06 15:19:32 +0200
committerAlexander Schmitz <arschmitz@gmail.com>2015-10-08 14:02:59 -0400
commit6ed30a6a5e789779549fee2972581ca0884a2e42 (patch)
tree4dc7c71a0dead598d6900a2d60e35613a0666d53
parentb61a3c74a900dc9d86e5a6ca8df9b3d73172619c (diff)
downloadjquery-ui-6ed30a6a5e789779549fee2972581ca0884a2e42.tar.gz
jquery-ui-6ed30a6a5e789779549fee2972581ca0884a2e42.zip
Controlgroup: Convert to onevar, fix guard-clause/else, rm tmp var
-rw-r--r--ui/widgets/controlgroup.js34
1 files changed, 18 insertions, 16 deletions
diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js
index d82efcd12..793874df5 100644
--- a/ui/widgets/controlgroup.js
+++ b/ui/widgets/controlgroup.js
@@ -69,13 +69,15 @@ return $.widget( "ui.controlgroup", {
// First we iterate over each of the items options
$.each( this.options.items, function( widget, selector ) {
- var widgets, labels,
- options = {};
+ var labels;
+ var options = {};
// Make sure the widget actually exists and has a selector set
if ( !$.fn[ widget ] || !selector ) {
return;
- } else if ( selector && widget === "controlgroupLabel" ) {
+ }
+
+ if ( widget === "controlgroupLabel" ) {
labels = that.element.find( selector );
labels.each( function() {
$( this ).contents().wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
@@ -92,19 +94,19 @@ return $.widget( "ui.controlgroup", {
}
// Find instances of this widget inside controlgroup and init them
- widgets = that.element.find( selector )[ widget ]( options );
-
- widgets.each( function() {
- var element = $( this );
-
- // Store an instance of the controlgroup to be able to reference
- // from the outermost element for changing options and refresh
- var widgetElement = element[ widget ]( "widget" );
- $.data( widgetElement[ 0 ], "ui-controlgroup-data",
- element[ widget ]( "instance" ) );
-
- childWidgets.push( widgetElement[ 0 ] );
- } );
+ that.element
+ .find( selector )[ widget ]( options )
+ .each( function() {
+ var element = $( this );
+
+ // Store an instance of the controlgroup to be able to reference
+ // from the outermost element for changing options and refresh
+ var widgetElement = element[ widget ]( "widget" );
+ $.data( widgetElement[ 0 ], "ui-controlgroup-data",
+ element[ widget ]( "instance" ) );
+
+ childWidgets.push( widgetElement[ 0 ] );
+ } );
} );
this.childWidgets = $( $.unique( childWidgets ) );