Permalink
Browse files

move delegate to bind to fix broken page sections test which dependen…

…ed on delegate bindings coming after regular bindings
  • Loading branch information...
1 parent 8adea34 commit 8f4f80929b3699aa870ac6b82a76ade3bf75bdd6 @johnbender committed May 16, 2012
Showing with 12 additions and 6 deletions.
  1. +8 −5 js/jquery.mobile.page.sections.js
  2. +4 −1 tests/unit/page-sections/index.html
@@ -3,7 +3,7 @@
//>>label: Page Sections
//>>group: Core
-define( [ "jquery", "./jquery.mobile.page", "./jquery.mobile.core", "./jquery.mobile.buttonMarkup" ], function( $ ) {
+define( [ "jquery", "./jquery.mobile.page", "./jquery.mobile.core" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
@@ -14,14 +14,17 @@ $.mobile.page.prototype.options.headerTheme = "a";
$.mobile.page.prototype.options.footerTheme = "a";
$.mobile.page.prototype.options.contentTheme = null;
-$( document ).delegate( ":jqmData(role='page'), :jqmData(role='dialog')", "pagecreate", function( e ) {
-
- var $page = $( this ),
+// NOTE bind used to force this binding to run before the buttonMarkup binding
+// which expects .ui-footer top be applied in its gigantic selector
+// TODO remove the buttonMarkup giant selector and move it to the various modules
+// on which it depends
+$( document ).bind( "pagecreate", function( e ) {
+ var $page = $( e.target ),
o = $page.data( "page" ).options,
pageRole = $page.jqmData( "role" ),
pageTheme = o.theme;
- $( ":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')", this )
+ $( ":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')", $page )
.jqmEnhanceable()
.each(function() {
@@ -16,7 +16,10 @@
"jquery.mobile.page",
"jquery.mobile.page.sections"
],
- [ "page_core.js" ],
+ [
+ "jquery.mobile.buttonMarkup",
+ "page_core.js"
+ ],
[ "jquery.mobile.init" ]
]);
</script>

0 comments on commit 8f4f809

Please sign in to comment.