aboutsummaryrefslogtreecommitdiffstats
path: root/ui/widgets/controlgroup.js
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-09-30 11:47:33 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-10-08 14:02:59 -0400
commitdbadc01fbd846d90cd01e34bc1c8f9194545f7f3 (patch)
tree9b16d7aacce63e19c8b0f6de1f0dde8d8383dccc /ui/widgets/controlgroup.js
parent874011ef0aa5b49cd5efede4159af396cefd7884 (diff)
downloadjquery-ui-dbadc01fbd846d90cd01e34bc1c8f9194545f7f3.tar.gz
jquery-ui-dbadc01fbd846d90cd01e34bc1c8f9194545f7f3.zip
Controlgroup: Typos and minor style fixes
Diffstat (limited to 'ui/widgets/controlgroup.js')
-rw-r--r--ui/widgets/controlgroup.js48
1 files changed, 26 insertions, 22 deletions
diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js
index 77559e50a..d82efcd12 100644
--- a/ui/widgets/controlgroup.js
+++ b/ui/widgets/controlgroup.js
@@ -12,7 +12,8 @@
//>>description: Visually groups form control widgets
//>>docs: http://api.jqueryui.com/controlgroup/
//>>demos: http://jqueryui.com/controlgroup/
-//>>css.structure: ../themes/base/core.css, ../themes/base/controlgroup.css
+//>>css.structure: ../themes/base/core.css
+//>>css.structure: ../themes/base/controlgroup.css
//>>css.theme: ../themes/base/theme.css
( function( factory ) {
@@ -71,28 +72,9 @@ return $.widget( "ui.controlgroup", {
var widgets, labels,
options = {};
- // We assume everything is in the middle to start because we can't determine
- // first / last elements until all enhancments are done.
- if ( that[ "_" + widget + "Options" ] ) {
- options = that[ "_" + widget + "Options" ]( "middle" );
- }
-
// Make sure the widget actually exists and has a selector set
- if ( $.fn[ widget ] && selector ) {
-
- // 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 it later
- var widgetElement = element[ widget ]( "widget" );
- $.data( widgetElement[ 0 ], "ui-controlgroup-data",
- element[ widget ]( "instance" ) );
-
- childWidgets.push( widgetElement[ 0 ] );
- } );
+ if ( !$.fn[ widget ] || !selector ) {
+ return;
} else if ( selector && widget === "controlgroupLabel" ) {
labels = that.element.find( selector );
labels.each( function() {
@@ -100,7 +82,29 @@ return $.widget( "ui.controlgroup", {
} );
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
childWidgets = childWidgets.concat( labels.get() );
+ return;
}
+
+ // We assume everything is in the middle to start because we can't determine
+ // first / last elements until all enhancments are done.
+ if ( that[ "_" + widget + "Options" ] ) {
+ options = that[ "_" + widget + "Options" ]( "middle" );
+ }
+
+ // 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 ] );
+ } );
} );
this.childWidgets = $( $.unique( childWidgets ) );