From 9a4eb1d8332d12524266a4e66166d5f53142584f Mon Sep 17 00:00:00 2001 From: "jblas@adobe.com" Date: Tue, 25 Oct 2011 17:06:01 -0700 Subject: [PATCH] Fix for issue #2835 - pagechangefailed not triggered when changing to non-existent internal page - Modified loadPage() so that it bails if an embedded page is not found within the DOM. --- js/jquery.mobile.navigation.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 60f972d3..f4c17b97 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -743,9 +743,15 @@ } // If we failed to find a page in the DOM, check the URL to see if it - // refers to the first page in the application. - if ( page.length === 0 && $.mobile.firstPage && path.isFirstPageUrl( fileUrl ) ) { - page = $( $.mobile.firstPage ); + // refers to the first page in the application. If it isn't a reference + // to the first page and refers to non-existent embedded page, error out. + if ( page.length === 0 ) { + if ( $.mobile.firstPage && path.isFirstPageUrl( fileUrl ) ) { + page = $( $.mobile.firstPage ); + } else if ( path.isEmbeddedPage( fileUrl ) ) { + deferred.reject( absUrl, options ); + return deferred.promise(); + } } // Reset base to the default document base.