Permalink
Browse files

Navigation: wait for DOM ready in addition to nav ready before listen…

…ing for "navigate" events
  • Loading branch information...
1 parent d74133c commit 2f2578231e000147a0878fe568822478d216c506 @gabrielschulhof gabrielschulhof committed Dec 11, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 js/jquery.mobile.navigation.js
@@ -26,6 +26,9 @@ define( [
//will be defined when a link is clicked and given an active class
$activeClickedLink = null,
+ // resolved on domready
+ domreadyDeferred = $.Deferred(),
+
//urlHistory is purely here to make guesses at whether the back or forward button was clicked
//and provide an appropriate transition
urlHistory = $.navigate.history,
@@ -1271,7 +1274,10 @@ define( [
$( window ).bind( "throttledresize", resetActivePageHeight );
};//navreadyDeferred done callback
- $.mobile.navreadyDeferred.done( function() { $.mobile._registerInternalEvents(); } );
+
+ $( function() { domreadyDeferred.resolve(); } );
+
+ $.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );
})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

0 comments on commit 2f25782

Please sign in to comment.