mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
Controlgroup: Convert to onevar, fix guard-clause/else, rm tmp var
This commit is contained in:
parent
b61a3c74a9
commit
6ed30a6a5e
@ -69,13 +69,15 @@ return $.widget( "ui.controlgroup", {
|
|||||||
|
|
||||||
// First we iterate over each of the items options
|
// First we iterate over each of the items options
|
||||||
$.each( this.options.items, function( widget, selector ) {
|
$.each( this.options.items, function( widget, selector ) {
|
||||||
var widgets, labels,
|
var labels;
|
||||||
options = {};
|
var options = {};
|
||||||
|
|
||||||
// Make sure the widget actually exists and has a selector set
|
// Make sure the widget actually exists and has a selector set
|
||||||
if ( !$.fn[ widget ] || !selector ) {
|
if ( !$.fn[ widget ] || !selector ) {
|
||||||
return;
|
return;
|
||||||
} else if ( selector && widget === "controlgroupLabel" ) {
|
}
|
||||||
|
|
||||||
|
if ( widget === "controlgroupLabel" ) {
|
||||||
labels = that.element.find( selector );
|
labels = that.element.find( selector );
|
||||||
labels.each( function() {
|
labels.each( function() {
|
||||||
$( this ).contents().wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
|
$( 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
|
// Find instances of this widget inside controlgroup and init them
|
||||||
widgets = that.element.find( selector )[ widget ]( options );
|
that.element
|
||||||
|
.find( selector )[ widget ]( options )
|
||||||
|
.each( function() {
|
||||||
|
var element = $( this );
|
||||||
|
|
||||||
widgets.each( function() {
|
// Store an instance of the controlgroup to be able to reference
|
||||||
var element = $( this );
|
// from the outermost element for changing options and refresh
|
||||||
|
var widgetElement = element[ widget ]( "widget" );
|
||||||
|
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
|
||||||
|
element[ widget ]( "instance" ) );
|
||||||
|
|
||||||
// Store an instance of the controlgroup to be able to reference
|
childWidgets.push( widgetElement[ 0 ] );
|
||||||
// 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 ) );
|
this.childWidgets = $( $.unique( childWidgets ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user