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

Commit 3974794

Browse files
committed
move the hash alteration below the snippets that determine the data that will go into a navigate call
1 parent 66edbea commit 3974794

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

js/jquery.mobile.navigation.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -875,14 +875,6 @@ define( [
875875
}
876876
}
877877

878-
// Set the location hash.
879-
if ( settings.changeHash !== false && url ) {
880-
//disable hash listening temporarily
881-
urlHistory.ignoreNextHashChange = true;
882-
//update hash and history
883-
path.set( url );
884-
}
885-
886878
// if title element wasn't found, try the page div data attr too
887879
// If this is a deep-link or a reload ( active === undefined ) then just use pageTitle
888880
var newPageTitle = ( !active )? pageTitle : toPage.jqmData( "title" ) || toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).getEncodedText();
@@ -907,6 +899,14 @@ define( [
907899
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
908900
}
909901

902+
// Set the location hash.
903+
if ( settings.changeHash !== false && url ) {
904+
//disable hash listening temporarily
905+
urlHistory.ignoreNextHashChange = true;
906+
//update hash and history
907+
path.set( url );
908+
}
909+
910910
//set page title
911911
document.title = urlHistory.getActive().title;
912912

js/navigation/navigate.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ define([
112112
return;
113113
}
114114

115+
// account for initial page load popstate, and other popstates triggered
116+
// by other parts of the application (ie, during the refactor)
117+
if( !event.originalEvent.state ) {
118+
return;
119+
}
120+
115121
// If this is a popstate that comes from the back or forward buttons
116122
// make sure to set the state of our history stack properly
117123
history.direct({

0 commit comments

Comments
 (0)