Skip to content
This repository
Browse code

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

…ng it as-is -- Fixes: #4806
  • Loading branch information...
commit 38ae834662e351b79d23ba065c02720ef0e84991 1 parent c029054
Gabriel "_|Nix|_" Schulhof authored August 06, 2012

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  js/jquery.mobile.navigation.js
10  js/jquery.mobile.navigation.js
@@ -1096,7 +1096,9 @@ define( [
1096 1096
 				alreadyThere = true;
1097 1097
 			}
1098 1098
 
1099  
-			url = ( active.url || "" ) + dialogHashKey;
  1099
+			// Normally, we tack on a dialog hash key, but if this is the location of a stale dialog,
  1100
+			// we reuse the URL from the entry
  1101
+			url = ( active.url || "" ) + ( alreadyThere ? "" : dialogHashKey );
1100 1102
 
1101 1103
 			// tack on another dialogHashKey if this is the same as the initial hash
1102 1104
 			// this makes sure that a history entry is created for this dialog
@@ -1129,7 +1131,11 @@ define( [
1129 1131
 			( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition );
1130 1132
 
1131 1133
 		//add page to history stack if it's not back or forward
1132  
-		if ( !historyDir && !alreadyThere ) {
  1134
+		if ( !historyDir ) {
  1135
+			// Overwrite the current entry if it's a leftover from a dialog
  1136
+			if ( alreadyThere ) {
  1137
+				urlHistory.activeIndex = Math.max( 0, urlHistory.activeIndex - 1 );
  1138
+			}
1133 1139
 			urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
1134 1140
 		}
1135 1141
 

0 notes on commit 38ae834

Please sign in to comment.
Something went wrong with that request. Please try again.