diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-14 09:49:48 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-10-08 14:02:47 -0400 |
commit | 3330634c4e4e6a1a7deff56a2d278ed9d8db0ce9 (patch) | |
tree | fb24e7f4d2ab8a3fa6f96cd172ce83d882c220b3 /ui | |
parent | 6c1390dc0d3c4f9f24196adf3aeba5a0566866e7 (diff) | |
download | jquery-ui-3330634c4e4e6a1a7deff56a2d278ed9d8db0ce9.tar.gz jquery-ui-3330634c4e4e6a1a7deff56a2d278ed9d8db0ce9.zip |
Controlgroup: fixup for spinner and label
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/controlgroup.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js index 3887c7abf..4e68ad7a8 100644 --- a/ui/widgets/controlgroup.js +++ b/ui/widgets/controlgroup.js @@ -80,25 +80,25 @@ return $.widget( "ui.controlgroup", { // Make sure the widget actually exists and has a selector set if ( $.fn[ widget ] && selector ) { - // Find instances of this widget inside controlgroup and run method or set options + // Find instances of this widget inside controlgroup and set options widgets = that.element.find( selector )[ widget ]( options ); - // Don't set data or add to the collection if the method is destroy widgets.each( function() { - var element = $( this ); + var element = $( this ), // Set data on the widget element pointing to the this.element of the widget // and telling us what type of widget this is - var widgetElement = - element[ widget ]( "widget" ).data( "ui-controlgroup-data", element.data( "ui-" + - widget.charAt(0).toUpperCase() + widget.slice(1) ) ); + widgetElement = element[ widget ]( "widget" ).data( + "ui-controlgroup-data", + element.data( "ui-" + widget.charAt(0).toUpperCase() + widget.slice(1) ) + ); childWidgets.push( widgetElement[ 0 ] ); } ); } else if ( selector && widget === "controlgroupLabel" ) { labels = that.element.find( selector ); that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); - Array.prototype.push.apply( childWidgets, labels ); + Array.prototype.push.apply( childWidgets, labels.get() ); } } ); @@ -116,6 +116,15 @@ return $.widget( "ui.controlgroup", { } ); }, + _updateCornerClass: function( element, position ) { + var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right", + add = + this._buildSimpleOptions( position, this.options.direction, "label" ).classes.label; + + this._removeClass( element, null, remove ); + this._addClass( element, null, add ); + }, + _buildSimpleOptions: function( position, direction, key ) { var result = { classes: {} @@ -217,6 +226,8 @@ return $.widget( "ui.controlgroup", { that.options.direction === "vertical" ) ); + } else { + that._updateCornerClass( children[ value ](), value ); } } ); |