Skip to content
This repository
Browse code

Merge pull request #4285 from uGoMobi/issue_4185

Fixes #4185 - When leaving from a page contains nested listview, pageremove event does not fire
  • Loading branch information...
commit 7aa65ac931c5d91e9f3727183526e619212f630a 1 parent fe55447
authored uGoMobi committed

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  js/jquery.mobile.listview.js
8  js/jquery.mobile.listview.js
@@ -378,13 +378,17 @@ $.widget( "mobile.listview", $.mobile.widget, {
378 378
 			parentPage.data("page").options.domCache === false ) {
379 379
 
380 380
 			var newRemove = function( e, ui ){
381  
-				var nextPage = ui.nextPage, npURL;
  381
+				var nextPage = ui.nextPage, npURL,
  382
+					prEvent = new $.Event( "pageremove" );
382 383
 
383 384
 				if( ui.nextPage ){
384 385
 					npURL = nextPage.jqmData( "url" );
385 386
 					if( npURL.indexOf( parentUrl + "&" + $.mobile.subPageUrlKey ) !== 0 ){
386 387
 						self.childPages().remove();
387  
-						parentPage.remove();
  388
+						parentPage.trigger( prEvent );
  389
+						if( !prEvent.isDefaultPrevented() ){
  390
+							parentPage.removeWithDependents();
  391
+						}
388 392
 					}
389 393
 				}
390 394
 			};

0 notes on commit 7aa65ac

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