Permalink
Browse files

Controlgroup: ensure load order does not matter for child widgets

  • Loading branch information...
arschmitz committed Aug 6, 2013
1 parent b6d9912 commit 92ef12ae0f47df8578d6707205bdc5e317f2fbe9
Showing with 8 additions and 6 deletions.
  1. +4 −4 js/widgets/controlgroup.js
  2. +4 −2 tests/unit/controlgroup/index.html
@@ -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 ));
@@ -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 ) : "" );
@@ -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" ]
]);

0 comments on commit 92ef12a

Please sign in to comment.