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

Commit

Permalink
Controlgroup: ensure load order does not matter for child widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
arschmitz committed Aug 6, 2013
1 parent b6d9912 commit 92ef12a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions js/widgets/controlgroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ $.widget( "mobile.controlgroup", $.extend( {
this.element.find( $.mobile.enhanceWithButtonMarkup.initSelector ).each( $.mobile.enhanceWithButtonMarkup );
}
// Enhance child widgets
$.each( this._childWidgets, $.proxy( function( number, widget ) {
if( widget ) {
this.element.find( widget.initSelector )[ widget.prototype.widgetName ]();
$.each( this._childWidgets, $.proxy( function( number, widgetName ) {
if( $.mobile[ widgetName ] ) {
this.element.find( $.mobile[ widgetName ].initSelector )[ widgetName ]();
}
}, this ));

Expand All @@ -53,7 +53,7 @@ $.widget( "mobile.controlgroup", $.extend( {

},

_childWidgets: [ $.mobile.checkboxradio, $.mobile.selectmenu, $.mobile.button ],
_childWidgets: [ "checkboxradio", "selectmenu", "button" ],

_themeClassFromOption: function( value ) {
return ( value ? ( value === "none" ? "" : "ui-group-theme-" + value ) : "" );
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/controlgroup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
<script src="../../../external/qunit.js"></script>
<script>
$.testHelper.asyncLoad([
[ "widgets/page" ],
['widgets/page'],
[
"widgets/forms/checkboxradio",
"widgets/controlgroup",
"jquery.mobile.buttonMarkup"

],
["widgets/forms/checkboxradio"],

[ "jquery.mobile.init" ],
[ "controlgroup_core.js" ]
]);
Expand Down

0 comments on commit 92ef12a

Please sign in to comment.