mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-29 18:34:43 +00:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
30fb05c162
3 changed files with 49 additions and 18 deletions
|
|
@ -260,20 +260,22 @@ $.widget( "mobile.listview", $.mobile.widget, {
|
|||
|
||||
//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 ){
|
||||
var newRemove = function( e, ui ){
|
||||
var nextPage = ui.nextPage, npURL;
|
||||
|
||||
if( ui.nextPage ){
|
||||
npURL = nextPage.jqmData( "url" );
|
||||
if( npURL.indexOf( parentUrl + "&" + $.mobile.subPageUrlKey ) !== 0 ){
|
||||
self.childPages().remove();
|
||||
parentPage.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// unbind the original page remove and replace with our specialized version
|
||||
parentPage
|
||||
.unbind( "pagehide.remove" )
|
||||
.bind( "pagehide.remove", function( e, ui ){
|
||||
var nextPage = ui.nextPage,
|
||||
npURL;
|
||||
|
||||
if( ui.nextPage ){
|
||||
npURL = nextPage.jqmData( "url" );
|
||||
if( npURL.indexOf( parentUrl + "&" + $.mobile.subPageUrlKey ) !== 0 ){
|
||||
self.childPages().remove();
|
||||
parentPage.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
.bind( "pagehide.remove", newRemove);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -693,12 +693,16 @@
|
|||
.attr( "data-" + $.mobile.ns + "url", path.convertUrlToDataUrl( fileUrl ) )
|
||||
.appendTo( settings.pageContainer );
|
||||
|
||||
// when dom caching is not enabled bind to remove the page on hide
|
||||
if( !page.jqmData("domCache") ){
|
||||
page.bind( "pagehide.remove", function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
// wait for page creation to leverage options defined on widget
|
||||
page.one('pagecreate', function(){
|
||||
|
||||
// when dom caching is not enabled bind to remove the page on hide
|
||||
if( !page.data("page").options.domCache ){
|
||||
page.bind( "pagehide.remove", function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
enhancePage( page, settings.role );
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,31 @@
|
|||
]);
|
||||
});
|
||||
|
||||
asyncTest( "external page is cached in the DOM after pagehide when option is set globally", function(){
|
||||
$.testHelper.pageSequence([
|
||||
navigateTestRoot,
|
||||
|
||||
function(){
|
||||
$.mobile.page.prototype.options.domCache = true;
|
||||
$.mobile.changePage( "external.html" );
|
||||
},
|
||||
|
||||
// page is pulled and displayed in the dom
|
||||
function(){
|
||||
same( $( "#external-test" ).length, 1 );
|
||||
window.history.back();
|
||||
},
|
||||
|
||||
// external test page is cached in the dom after transitioning away
|
||||
function(){
|
||||
same( $( "#external-test" ).length, 1 );
|
||||
$.mobile.page.prototype.options.domCache = false;
|
||||
$( "#external-test" ).remove();
|
||||
start();
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
asyncTest( "forms with data attribute ajax set to false will not call changePage", function(){
|
||||
var called = false;
|
||||
var newChangePage = function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue