From c426aefd764d7a2242af0713fd8c0b4a23f942b9 Mon Sep 17 00:00:00 2001 From: John Bender Date: Mon, 12 Sep 2011 14:06:47 -0700 Subject: [PATCH] add data attribute tag for pages loaded via ajax Fixes #2432 --- js/jquery.mobile.listview.js | 8 ++++++-- js/jquery.mobile.navigation.js | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.listview.js b/js/jquery.mobile.listview.js index dbaa3ad1..ee94e12e 100644 --- a/js/jquery.mobile.listview.js +++ b/js/jquery.mobile.listview.js @@ -269,8 +269,12 @@ $.widget( "mobile.listview", $.mobile.widget, { }).listview(); - //on pagehide, remove any nested pages along with the parent page, as long as they aren't active - if( hasSubPages && parentPage.data("page").options.domCache === false ){ + // on pagehide, remove any nested pages along with the parent page, as long as they aren't active + // and aren't embedded + if( hasSubPages && + parentPage.is( "jqmData(external-page='true')" ) && + parentPage.data("page").options.domCache === false ) { + var newRemove = function( e, ui ){ var nextPage = ui.nextPage, npURL; diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 138d4d31..482559d9 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -784,8 +784,12 @@ } //append to page and enhance + // TODO taging a page with external to make sure that embedded pages aren't removed + // by the various page handling code is bad. Having page handling code in many + // places is bad. Solutions post 1.0 page .attr( "data-" + $.mobile.ns + "url", path.convertUrlToDataUrl( fileUrl ) ) + .attr( "data-" + $.mobile.ns + "external-page", true ) .appendTo( settings.pageContainer ); // wait for page creation to leverage options defined on widget