@@ -97,6 +97,9 @@ return $.widget( "ui.controlgroup", {
9797 } ) ;
9898 } else if ( selector && widget === "controlgroupLabel" ) {
9999 labels = that . element . find ( selector ) ;
100+ labels . each ( function ( ) {
101+ $ ( this ) . contents ( ) . wrapAll ( "<span class='ui-controlgroup-label-contents'></span>" ) ;
102+ } ) ;
100103 that . _addClass ( labels , null , "ui-widget ui-widget-content ui-state-default" ) ;
101104 Array . prototype . push . apply ( childWidgets , labels . get ( ) ) ;
102105 }
@@ -117,9 +120,9 @@ return $.widget( "ui.controlgroup", {
117120 } ,
118121
119122 _updateCornerClass : function ( element , position ) {
120- var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right" ,
121- add =
122- this . _buildSimpleOptions ( position , this . options . direction , "label" ) . classes . label ;
123+ var direction = this . options . direction === "vertical"
124+ remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right" ,
125+ add = this . _buildSimpleOptions ( position , direction , "label" ) . classes . label ;
123126
124127 this . _removeClass ( element , null , remove ) ;
125128 this . _addClass ( element , null , add ) ;
@@ -219,7 +222,7 @@ return $.widget( "ui.controlgroup", {
219222 $ . each ( [ "first" , "last" ] , function ( index , value ) {
220223 var instance = children [ value ] ( ) . data ( "ui-controlgroup-data" ) ;
221224
222- if ( that [ "_" + instance . widgetName + "_options" ] ) {
225+ if ( instance && that [ "_" + instance . widgetName + "_options" ] ) {
223226 instance . element [ instance . widgetName ] (
224227 that [ "_" + instance . widgetName + "_options" ] (
225228 value ,
0 commit comments