mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-02 20:04:43 +00:00
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.
This commit is contained in:
parent
3133b36b37
commit
97e3f8a800
1 changed files with 11 additions and 1 deletions
|
|
@ -748,7 +748,17 @@
|
|||
// 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 );
|
||||
// Check to make sure our cached-first-page is actually
|
||||
// in the DOM. Some user deployed apps are pruning the first
|
||||
// page from the DOM for various reasons, we check for this
|
||||
// case here because we don't want a first-page with an id
|
||||
// falling through to the non-existent embedded page error
|
||||
// case. If the first-page is not in the DOM, then we let
|
||||
// things fall through to the ajax loading code below so
|
||||
// that it gets reloaded.
|
||||
if ( $.mobile.firstPage.parent().length ) {
|
||||
page = $( $.mobile.firstPage );
|
||||
}
|
||||
} else if ( path.isEmbeddedPage( fileUrl ) ) {
|
||||
deferred.reject( absUrl, options );
|
||||
return deferred.promise();
|
||||
|
|
|
|||
Loading…
Reference in a new issue