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

Commit d952878

Browse files
author
Gabriel Schulhof
committed
[controlgroup] Delay registration of enhancement hook until dom-ready
1 parent 1126621 commit d952878

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

js/widgets/controlgroup.js

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

88
define( [ "jquery",
99
"../jquery.mobile.buttonMarkup",
10-
"./forms/button",
1110
"../jquery.mobile.widget" ], function( $ ) {
1211
//>>excludeEnd("jqmBuildExclude");
1312
(function( $, undefined ) {
@@ -101,8 +100,18 @@ define( [ "jquery",
101100
}
102101
});
103102

104-
$( document ).bind( "pagecreate create", function( e ) {
105-
$.mobile.controlgroup.prototype.enhanceWithin( e.target, true );
103+
// TODO: Implement a mechanism to allow widgets to become enhanced in the
104+
// correct order when their correct enhancement depends on other widgets in
105+
// the page being correctly enhanced already.
106+
//
107+
// For now, we wait until dom-ready to attach the controlgroup's enhancement
108+
// hook, because by that time, all the other widgets' enhancement hooks should
109+
// already be in place, ensuring that all widgets that need to be grouped will
110+
// already have been enhanced by the time the controlgroup is created.
111+
$( function() {
112+
$( document ).bind( "pagecreate create", function( e ) {
113+
$.mobile.controlgroup.prototype.enhanceWithin( e.target, true );
114+
});
106115
});
107116
})(jQuery);
108117
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

0 commit comments

Comments
 (0)