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

Commit 92ef12a

Browse files
committed
Controlgroup: ensure load order does not matter for child widgets
1 parent b6d9912 commit 92ef12a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

js/widgets/controlgroup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ $.widget( "mobile.controlgroup", $.extend( {
3131
this.element.find( $.mobile.enhanceWithButtonMarkup.initSelector ).each( $.mobile.enhanceWithButtonMarkup );
3232
}
3333
// Enhance child widgets
34-
$.each( this._childWidgets, $.proxy( function( number, widget ) {
35-
if( widget ) {
36-
this.element.find( widget.initSelector )[ widget.prototype.widgetName ]();
34+
$.each( this._childWidgets, $.proxy( function( number, widgetName ) {
35+
if( $.mobile[ widgetName ] ) {
36+
this.element.find( $.mobile[ widgetName ].initSelector )[ widgetName ]();
3737
}
3838
}, this ));
3939

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

5454
},
5555

56-
_childWidgets: [ $.mobile.checkboxradio, $.mobile.selectmenu, $.mobile.button ],
56+
_childWidgets: [ "checkboxradio", "selectmenu", "button" ],
5757

5858
_themeClassFromOption: function( value ) {
5959
return ( value ? ( value === "none" ? "" : "ui-group-theme-" + value ) : "" );

tests/unit/controlgroup/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
<script src="../../../external/qunit.js"></script>
1414
<script>
1515
$.testHelper.asyncLoad([
16-
[ "widgets/page" ],
16+
['widgets/page'],
1717
[
18-
"widgets/forms/checkboxradio",
1918
"widgets/controlgroup",
2019
"jquery.mobile.buttonMarkup"
20+
2121
],
22+
["widgets/forms/checkboxradio"],
23+
2224
[ "jquery.mobile.init" ],
2325
[ "controlgroup_core.js" ]
2426
]);

0 commit comments

Comments
 (0)