Skip to content
This repository
Browse code

moved our form binding into the _registerInternalEvents callback, to …

…ensure it's not bound until after mobilinit.
  • Loading branch information...
commit a43ce64db29fc6cd8d4f0a850526551b8d67bb37 1 parent 68a354e
authored June 22, 2011

Showing 1 changed file with 30 additions and 31 deletions. Show diff stats Hide diff stats

  1. 61  js/jquery.mobile.navigation.js
61  js/jquery.mobile.navigation.js
@@ -926,37 +926,6 @@
926 926
 	};
927 927
 
928 928
 /* Event Bindings - hashchange, submit, and click */
929  
-
930  
-	//bind to form submit events, handle with Ajax
931  
-	$( "form" ).live('submit', function( event ) {
932  
-		var $this = $( this );
933  
-		if( !$.mobile.ajaxEnabled ||
934  
-			$this.is( ":jqmData(ajax='false')" ) ) {
935  
-				return;
936  
-			}
937  
-
938  
-		var type = $this.attr( "method" ),
939  
-			url = path.makeUrlAbsolute( $this.attr( "action" ), getClosestBaseUrl($this) ),
940  
-			target = $this.attr( "target" );
941  
-
942  
-		//external submits use regular HTTP
943  
-		if( path.isExternal( url ) || target ) {
944  
-			return;
945  
-		}
946  
-
947  
-		$.mobile.changePage(
948  
-			url,
949  
-			{
950  
-				type:		type.length && type.toLowerCase() || "get",
951  
-				data:		$this.serialize(),
952  
-				transition:	$this.jqmData( "transition" ),
953  
-				direction:	$this.jqmData( "direction" ),
954  
-				reloadPage:	true
955  
-			}
956  
-		);
957  
-		event.preventDefault();
958  
-	});
959  
-
960 929
 	function findClosestLink( ele )
961 930
 	{
962 931
 		while ( ele ) {
@@ -986,6 +955,36 @@
986 955
 	//The following event bindings should be bound after mobileinit has been triggered
987 956
 	//the following function is called in the init file
988 957
 	$.mobile._registerInternalEvents = function(){
  958
+		
  959
+		//bind to form submit events, handle with Ajax
  960
+		$( "form" ).live('submit', function( event ) {
  961
+			var $this = $( this );
  962
+			if( !$.mobile.ajaxEnabled ||
  963
+				$this.is( ":jqmData(ajax='false')" ) ) {
  964
+					return;
  965
+				}
  966
+
  967
+			var type = $this.attr( "method" ),
  968
+				url = path.makeUrlAbsolute( $this.attr( "action" ), getClosestBaseUrl($this) ),
  969
+				target = $this.attr( "target" );
  970
+
  971
+			//external submits use regular HTTP
  972
+			if( path.isExternal( url ) || target ) {
  973
+				return;
  974
+			}
  975
+
  976
+			$.mobile.changePage(
  977
+				url,
  978
+				{
  979
+					type:		type.length && type.toLowerCase() || "get",
  980
+					data:		$this.serialize(),
  981
+					transition:	$this.jqmData( "transition" ),
  982
+					direction:	$this.jqmData( "direction" ),
  983
+					reloadPage:	true
  984
+				}
  985
+			);
  986
+			event.preventDefault();
  987
+		});
989 988
 
990 989
 		//add active state on vclick
991 990
 		$( document ).bind( "vclick", function( event ) {

0 notes on commit a43ce64

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