Skip to content
This repository
Browse code

fix for cached page removal breaking dialog sized select menus Fixes #…

  • Loading branch information...
commit f1d964e9e9b1d6e48325d00a13b22ac0771305ac 1 parent f7d5d91
John Bender authored August 01, 2011

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. 12  js/jquery.mobile.forms.select.js
12  js/jquery.mobile.forms.select.js
@@ -230,7 +230,6 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
230 230
 				})
231 231
 				.delegate( "li:not(.ui-disabled, .ui-li-divider)", "vclick", function( event ) {
232 232
 
233  
-					
234 233
 					var $this = $( this ),
235 234
 						// index of option tag to be selected
236 235
 						oldIndex = select[ 0 ].selectedIndex,
@@ -484,6 +483,10 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
484 483
 		}
485 484
 
486 485
 		if ( menuHeight > screenHeight - 80 || !$.support.scrollTop ) {
  486
+			// prevent the parent page from being removed from the DOM,
  487
+			// otherwise the results of selecting a list item in the dialog
  488
+			// fall into a black hole
  489
+			self.thisPage.unbind( "pagehide.remove" );
487 490
 
488 491
 			//for webos (set lastscroll using button offset)
489 492
 			if ( scrollTop == 0 && btnOffset > screenHeight ) {
@@ -577,6 +580,13 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
577 580
 		var self = this;
578 581
 
579 582
 		if ( self.menuType == "page" ) {
  583
+			// rebind the page remove that was unbound in the open function
  584
+			// to allow for the parent page removal from actions other than the use
  585
+			// of a dialog sized custom select
  586
+			self.thisPage.bind( "pagehide.remove", function(){
  587
+				$(this).remove();
  588
+			});
  589
+
580 590
 			// doesn't solve the possible issue with calling change page
581 591
 			// where the objects don't define data urls which prevents dialog key
582 592
 			// stripping - changePage has incoming refactor

0 notes on commit f1d964e

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