Permalink
Browse files

[controlgroup] Update first/last classes using common behaviour

  • Loading branch information...
gabrielschulhof committed Nov 9, 2012
1 parent 07c3339 commit 32e427bdc4fe89b85aff43b26870dbb268c92677
Showing with 4 additions and 7 deletions.
  1. +4 −7 js/widgets/controlgroup.js
View
@@ -7,6 +7,7 @@
define( [ "jquery",
"../jquery.mobile.buttonMarkup",
"./addFirstLastClasses",
"../jquery.mobile.widget" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
@@ -82,20 +83,16 @@ define( [ "jquery",
_refresh: function( create ) {
var els = this.element.find( ".ui-btn" ).not( ".ui-slider-handle" );
els.removeClass( "ui-first-child ui-last-child" );
if ( !create && this.options.excludeInvisible ) {
els = els.filter( ":visible" );
}
els.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" );
this._addFirstLastClasses( els, this.options.excludeInvisible ? this._getVisibles( els, create ) : els, create );
},
refresh: function() {
this._refresh( false );
}
});
$.widget( "mobile.controlgroup", $.mobile.controlgroup, $.mobile.behaviors.addFirstLastClasses );
// TODO: Implement a mechanism to allow widgets to become enhanced in the
// correct order when their correct enhancement depends on other widgets in
// the page being correctly enhanced already.

0 comments on commit 32e427b

Please sign in to comment.