diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2016-05-11 12:14:14 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2016-05-26 09:15:48 -0400 |
commit | 7d5e6d24969ef84eee51ae5b1557c7ce2e83c9ea (patch) | |
tree | 497c0126545ba1eea94694d12a54ecc696c6060d /ui/widgets | |
parent | 81a8e30c07a3663728c98b15775b5580fa806cdd (diff) | |
download | jquery-ui-7d5e6d24969ef84eee51ae5b1557c7ce2e83c9ea.tar.gz jquery-ui-7d5e6d24969ef84eee51ae5b1557c7ce2e83c9ea.zip |
Controlgroup: Fix rendering of labels
Fixes #14967
Closes gh-1703
Diffstat (limited to 'ui/widgets')
-rw-r--r-- | ui/widgets/controlgroup.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js index 34b2ba9c7..a79491bfb 100644 --- a/ui/widgets/controlgroup.js +++ b/ui/widgets/controlgroup.js @@ -30,7 +30,7 @@ factory( jQuery ); } }( function( $ ) { -var removeClassRegex = /ui-corner-([a-z]){2,6}/g; +var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; return $.widget( "ui.controlgroup", { version: "@VERSION", @@ -87,7 +87,12 @@ return $.widget( "ui.controlgroup", { if ( widget === "controlgroupLabel" ) { labels = that.element.find( selector ); labels.each( function() { - $( this ).contents() + var element = $( this ); + + if ( element.children( ".ui-controlgroup-label-contents" ).length ) { + return; + } + element.contents() .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); } ); that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); @@ -210,8 +215,8 @@ return $.widget( "ui.controlgroup", { _resolveClassesValues: function( classes, instance ) { $.each( classes, function( key ) { var current = instance.options.classes[ key ] || ""; - current = current.replace( removeClassRegex, "" ).trim(); - classes[ key ] = ( current + " " + classes[ key ] ).replace( / +/g, " " ); + current = current.replace( controlgroupCornerRegex, "" ).trim(); + classes[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); } ); return classes; }, |