Skip to content
This repository
Browse code

Fix for issue #2520 - No longer able to remove / expire pages reliably

- Modified loadPage() so that if we are attempting to load the first page of the application document, that we first check to make sure it is in the DOM before returning our cached copy. If it is not in the DOM, we let it fall through to the ajax loading code so that it gets recreated. This is necessary since some developers are agressively pruning pages, including embedded ones, for various reasons.
  • Loading branch information...
commit 97e3f8a800a44227ceff13d1c825953a051ef782 1 parent 3133b36
Kin Blas authored November 04, 2011

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. 12  js/jquery.mobile.navigation.js
12  js/jquery.mobile.navigation.js
@@ -748,7 +748,17 @@
748 748
 		// to the first page and refers to non-existent embedded page, error out.
749 749
 		if ( page.length === 0 ) {
750 750
 			if ( $.mobile.firstPage && path.isFirstPageUrl( fileUrl ) ) {
751  
-				page = $( $.mobile.firstPage );
  751
+				// Check to make sure our cached-first-page is actually
  752
+				// in the DOM. Some user deployed apps are pruning the first
  753
+				// page from the DOM for various reasons, we check for this
  754
+				// case here because we don't want a first-page with an id
  755
+				// falling through to the non-existent embedded page error
  756
+				// case. If the first-page is not in the DOM, then we let
  757
+				// things fall through to the ajax loading code below so
  758
+				// that it gets reloaded.
  759
+				if ( $.mobile.firstPage.parent().length ) {
  760
+					page = $( $.mobile.firstPage );
  761
+				}
752 762
 			} else if ( path.isEmbeddedPage( fileUrl )  ) {
753 763
 				deferred.reject( absUrl, options );
754 764
 				return deferred.promise();

0 notes on commit 97e3f8a

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