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

Commit

Permalink
move the hash alteration below the snippets that determine the data t…
Browse files Browse the repository at this point in the history
…hat will go into a navigate call
  • Loading branch information
johnbender committed Oct 25, 2012
1 parent 66edbea commit 3974794
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 8 additions & 8 deletions js/jquery.mobile.navigation.js
Expand Up @@ -875,14 +875,6 @@ define( [
}
}

// Set the location hash.
if ( settings.changeHash !== false && url ) {
//disable hash listening temporarily
urlHistory.ignoreNextHashChange = true;
//update hash and history
path.set( url );
}

// if title element wasn't found, try the page div data attr too
// If this is a deep-link or a reload ( active === undefined ) then just use pageTitle
var newPageTitle = ( !active )? pageTitle : toPage.jqmData( "title" ) || toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).getEncodedText();
Expand All @@ -907,6 +899,14 @@ define( [
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
}

// Set the location hash.
if ( settings.changeHash !== false && url ) {
//disable hash listening temporarily
urlHistory.ignoreNextHashChange = true;
//update hash and history
path.set( url );
}

//set page title
document.title = urlHistory.getActive().title;

Expand Down
6 changes: 6 additions & 0 deletions js/navigation/navigate.js
Expand Up @@ -112,6 +112,12 @@ define([
return;
}

// account for initial page load popstate, and other popstates triggered
// by other parts of the application (ie, during the refactor)
if( !event.originalEvent.state ) {
return;
}

// If this is a popstate that comes from the back or forward buttons
// make sure to set the state of our history stack properly
history.direct({
Expand Down

0 comments on commit 3974794

Please sign in to comment.