Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[navigation] Overwrite stale dialog urlHistory entry instead of reusi…

…ng it as-is -- Fixes: #4806
  • Loading branch information...
commit 38ae834662e351b79d23ba065c02720ef0e84991 1 parent c029054
@gabrielschulhof gabrielschulhof authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 js/jquery.mobile.navigation.js
View
10 js/jquery.mobile.navigation.js
@@ -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
@@ -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 );
}
Please sign in to comment.
Something went wrong with that request. Please try again.