Skip to content

Commit

Permalink
[navigation] Overwrite stale dialog urlHistory entry instead of reusi…
Browse files Browse the repository at this point in the history
…ng it as-is -- Fixes: jquery-archive#4806
  • Loading branch information
Gabriel Schulhof authored and arschmitz committed Oct 16, 2012
1 parent c34005c commit 141d8d1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/jquery.mobile.navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,9 @@ define( [
alreadyThere = true;
}

url = ( active.url || "" ) + dialogHashKey;
// Normally, we tack on a dialog hash key, but if this is the location of a stale dialog,
// we reuse the URL from the entry
url = ( active.url || "" ) + ( alreadyThere ? "" : dialogHashKey );

// tack on another dialogHashKey if this is the same as the initial hash
// this makes sure that a history entry is created for this dialog
Expand Down Expand Up @@ -1129,7 +1131,11 @@ define( [
( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition );

//add page to history stack if it's not back or forward
if ( !historyDir && !alreadyThere ) {
if ( !historyDir ) {
// Overwrite the current entry if it's a leftover from a dialog
if ( alreadyThere ) {
urlHistory.activeIndex = Math.max( 0, urlHistory.activeIndex - 1 );
}
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
}

Expand Down

0 comments on commit 141d8d1

Please sign in to comment.