Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
[controlgroup] Use enhanced buttonMarkup corner-encoding ability inst…
Browse files Browse the repository at this point in the history
…ead of setting corner classes manually -- Fixes #3635
  • Loading branch information
Gabriel Schulhof committed Oct 30, 2012
1 parent be1e872 commit 3c009a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/jquery.mobile.controlGroup.js
Expand Up @@ -11,10 +11,11 @@ define( [ "jquery", "./jquery.mobile.buttonMarkup" ], function( $ ) {

$.fn.controlgroup = function( options ) {
function flipClasses( els, flCorners ) {
els.removeClass( "ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow" )
.eq( 0 ).addClass( flCorners[ 0 ] )
els.removeClass( "ui-controlgroup-last" )
.buttonMarkup( { corners: false, shadow: false } )
.eq( 0 ).buttonMarkup( { corners: flCorners[ 0 ] } )
.end()
.last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
.last().buttonMarkup( { corners: flCorners[ 1 ] } ).addClass( "ui-controlgroup-last" );
}

return this.each(function() {
Expand All @@ -28,7 +29,7 @@ $.fn.controlgroup = function( options ) {
grouplegend = $el.children( "legend" ),
groupheading = $el.children( ".ui-controlgroup-label" ),
groupcontrols = $el.children( ".ui-controlgroup-controls" ),
flCorners = o.direction === "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ],
flCorners = o.direction === "horizontal" ? [ "left", "right" ] : [ "top", "bottom" ],
type = $el.find( "input" ).first().attr( "type" );

// First unwrap the controls if the controlgroup was already enhanced
Expand All @@ -49,7 +50,6 @@ $.fn.controlgroup = function( options ) {
$el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction );

flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners );
flipClasses( $el.find( ".ui-btn-inner" ), flCorners );

if ( o.shadow ) {
$el.addClass( "ui-shadow" );
Expand Down

0 comments on commit 3c009a6

Please sign in to comment.