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

Commit 2f25782

Browse files
author
Gabriel Schulhof
committed
Navigation: wait for DOM ready in addition to nav ready before listening for "navigate" events
1 parent d74133c commit 2f25782

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

js/jquery.mobile.navigation.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ define( [
2626
//will be defined when a link is clicked and given an active class
2727
$activeClickedLink = null,
2828

29+
// resolved on domready
30+
domreadyDeferred = $.Deferred(),
31+
2932
//urlHistory is purely here to make guesses at whether the back or forward button was clicked
3033
//and provide an appropriate transition
3134
urlHistory = $.navigate.history,
@@ -1271,7 +1274,10 @@ define( [
12711274
$( window ).bind( "throttledresize", resetActivePageHeight );
12721275

12731276
};//navreadyDeferred done callback
1274-
$.mobile.navreadyDeferred.done( function() { $.mobile._registerInternalEvents(); } );
1277+
1278+
$( function() { domreadyDeferred.resolve(); } );
1279+
1280+
$.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );
12751281

12761282
})( jQuery );
12771283
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

0 commit comments

Comments
 (0)