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

Commit 32e427b

Browse files
author
Gabriel Schulhof
committed
[controlgroup] Update first/last classes using common behaviour
1 parent 07c3339 commit 32e427b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

js/widgets/controlgroup.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
define( [ "jquery",
99
"../jquery.mobile.buttonMarkup",
10+
"./addFirstLastClasses",
1011
"../jquery.mobile.widget" ], function( $ ) {
1112
//>>excludeEnd("jqmBuildExclude");
1213
(function( $, undefined ) {
@@ -82,20 +83,16 @@ define( [ "jquery",
8283

8384
_refresh: function( create ) {
8485
var els = this.element.find( ".ui-btn" ).not( ".ui-slider-handle" );
85-
86-
els.removeClass( "ui-first-child ui-last-child" );
87-
if ( !create && this.options.excludeInvisible ) {
88-
els = els.filter( ":visible" );
89-
}
90-
91-
els.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" );
86+
this._addFirstLastClasses( els, this.options.excludeInvisible ? this._getVisibles( els, create ) : els, create );
9287
},
9388

9489
refresh: function() {
9590
this._refresh( false );
9691
}
9792
});
9893

94+
$.widget( "mobile.controlgroup", $.mobile.controlgroup, $.mobile.behaviors.addFirstLastClasses );
95+
9996
// TODO: Implement a mechanism to allow widgets to become enhanced in the
10097
// correct order when their correct enhancement depends on other widgets in
10198
// the page being correctly enhanced already.

0 commit comments

Comments
 (0)