Skip to content

Commit dbadc01

Browse files
committed
Controlgroup: Typos and minor style fixes
1 parent 874011e commit dbadc01

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

ui/widgets/controlgroup.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
//>>description: Visually groups form control widgets
1313
//>>docs: http://api.jqueryui.com/controlgroup/
1414
//>>demos: http://jqueryui.com/controlgroup/
15-
//>>css.structure: ../themes/base/core.css, ../themes/base/controlgroup.css
15+
//>>css.structure: ../themes/base/core.css
16+
//>>css.structure: ../themes/base/controlgroup.css
1617
//>>css.theme: ../themes/base/theme.css
1718

1819
( function( factory ) {
@@ -71,36 +72,39 @@ return $.widget( "ui.controlgroup", {
7172
var widgets, labels,
7273
options = {};
7374

74-
// We assume everything is in the middle to start because we can't determine
75-
// first / last elements until all enhancments are done.
76-
if ( that[ "_" + widget + "Options" ] ) {
77-
options = that[ "_" + widget + "Options" ]( "middle" );
78-
}
79-
8075
// Make sure the widget actually exists and has a selector set
81-
if ( $.fn[ widget ] && selector ) {
82-
83-
// Find instances of this widget inside controlgroup and init them
84-
widgets = that.element.find( selector )[ widget ]( options );
85-
86-
widgets.each( function() {
87-
var element = $( this );
88-
89-
// Store an instance of the controlgroup to be able to reference it later
90-
var widgetElement = element[ widget ]( "widget" );
91-
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
92-
element[ widget ]( "instance" ) );
93-
94-
childWidgets.push( widgetElement[ 0 ] );
95-
} );
76+
if ( !$.fn[ widget ] || !selector ) {
77+
return;
9678
} else if ( selector && widget === "controlgroupLabel" ) {
9779
labels = that.element.find( selector );
9880
labels.each( function() {
9981
$( this ).contents().wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
10082
} );
10183
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
10284
childWidgets = childWidgets.concat( labels.get() );
85+
return;
10386
}
87+
88+
// We assume everything is in the middle to start because we can't determine
89+
// first / last elements until all enhancments are done.
90+
if ( that[ "_" + widget + "Options" ] ) {
91+
options = that[ "_" + widget + "Options" ]( "middle" );
92+
}
93+
94+
// 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+
} );
104108
} );
105109

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

0 commit comments

Comments
 (0)