mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Moved function to outside each loop, to prevent it from being redefined each time the controlgroup widget is called.
This commit is contained in:
parent
40c400d657
commit
dc2760025c
1 changed files with 8 additions and 12 deletions
|
|
@ -7,9 +7,14 @@ define( [ "jquery", "jquery.mobile.buttonMarkup" ], function( $ ) {
|
|||
(function( $, undefined ) {
|
||||
|
||||
$.fn.controlgroup = function( options ) {
|
||||
function flipClasses( els, flCorners ) {
|
||||
els.removeClass( "ui-btn-corner-all ui-shadow" )
|
||||
.eq( 0 ).addClass( flCorners[ 0 ] )
|
||||
.end()
|
||||
.last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
var $el = $( this ),
|
||||
o = $.extend({
|
||||
direction: $el.jqmData( "type" ) || "vertical",
|
||||
|
|
@ -29,17 +34,8 @@ $.fn.controlgroup = function( options ) {
|
|||
|
||||
$el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction );
|
||||
|
||||
// TODO: This should be moved out to the closure
|
||||
// otherwise it is redefined each time controlgroup() is called
|
||||
function flipClasses( els ) {
|
||||
els.removeClass( "ui-btn-corner-all ui-shadow" )
|
||||
.eq( 0 ).addClass( flCorners[ 0 ] )
|
||||
.end()
|
||||
.last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
|
||||
}
|
||||
|
||||
flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ) );
|
||||
flipClasses( $el.find( ".ui-btn-inner" ) );
|
||||
flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ), flCorners );
|
||||
flipClasses( $el.find( ".ui-btn-inner" ), flCorners );
|
||||
|
||||
if ( o.shadow ) {
|
||||
$el.addClass( "ui-shadow" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue