From c75a7ad654f0ef30f52de6ca33d8492af6692065 Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Tue, 20 Sep 2011 14:45:26 -0700 Subject: [PATCH 1/5] Fix for issue 1666 - Deprecate $.mobile.pageLoading() - Removed $.mobile.pageLoading(). - Updated tests/unit/init/ to call the new showPageLoadingMsg/hidePageLoadingMsg functions. --- js/jquery.mobile.init.js | 9 --------- tests/unit/init/init_core.js | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/js/jquery.mobile.init.js b/js/jquery.mobile.init.js index 3a49efdc..1a66e0bd 100644 --- a/js/jquery.mobile.init.js +++ b/js/jquery.mobile.init.js @@ -60,15 +60,6 @@ $html.removeClass( "ui-loading" ); }, - // XXX: deprecate for 1.0 - pageLoading: function ( done ) { - if ( done ) { - $.mobile.hidePageLoadingMsg(); - } else { - $.mobile.showPageLoadingMsg(); - } - }, - // find and enhance the pages in the dom and transition to the first page. initializePage: function() { // find present pages diff --git a/tests/unit/init/init_core.js b/tests/unit/init/init_core.js index 14d5e60f..171d9a99 100644 --- a/tests/unit/init/init_core.js +++ b/tests/unit/init/init_core.js @@ -25,7 +25,7 @@ teardown: function(){ $.extend = extendFn; - // NOTE reset for pageLoading tests + // NOTE reset for showPageLoadingMsg/hidePageLoadingMsg tests $('.ui-loader').remove(); // clear the classes added by reloading the init @@ -147,10 +147,10 @@ same($("#bar").jqmData('url'), "bak"); }); - asyncTest( "pageLoading doesn't add the dialog to the page when loading message is false", function(){ + asyncTest( "showPageLoadingMsg doesn't add the dialog to the page when loading message is false", function(){ expect( 1 ); $.mobile.loadingMessage = false; - $.mobile.pageLoading(false); + $.mobile.showPageLoadingMsg(); setTimeout(function(){ ok(!$(".ui-loader").length, "no ui-loader element"); @@ -158,10 +158,10 @@ }, 500); }); - asyncTest( "pageLoading doesn't add the dialog to the page when done is passed as true", function(){ + asyncTest( "hidePageLoadingMsg doesn't add the dialog to the page when loading message is false", function(){ expect( 1 ); $.mobile.loadingMessage = true; - $.mobile.pageLoading(true); + $.mobile.hidePageLoadingMsg(); setTimeout(function(){ same($(".ui-loading").length, 0, "page should not be in the loading state"); @@ -169,10 +169,10 @@ }, 500); }); - asyncTest( "pageLoading adds the dialog to the page when done is true", function(){ + asyncTest( "showPageLoadingMsg adds the dialog to the page when loadingMessage is true", function(){ expect( 1 ); $.mobile.loadingMessage = true; - $.mobile.pageLoading(false); + $.mobile.showPageLoadingMsg(); setTimeout(function(){ same($(".ui-loading").length, 1, "page should be in the loading state"); @@ -183,7 +183,7 @@ asyncTest( "page loading should contain default loading message", function(){ expect( 1 ); reloadCoreNSandInit(); - $.mobile.pageLoading(false); + $.mobile.showPageLoadingMsg(); setTimeout(function(){ same($(".ui-loader h1").text(), "loading"); @@ -194,7 +194,7 @@ asyncTest( "page loading should contain custom loading message", function(){ $.mobile.loadingMessage = "foo"; $.testHelper.reloadLib(libName); - $.mobile.pageLoading(false); + $.mobile.showPageLoadingMsg(); setTimeout(function(){ same($(".ui-loader h1").text(), "foo"); @@ -204,7 +204,7 @@ asyncTest( "page loading should contain custom loading message when set during runtime", function(){ $.mobile.loadingMessage = "bar"; - $.mobile.pageLoading(false); + $.mobile.showPageLoadingMsg(); setTimeout(function(){ same($(".ui-loader h1").text(), "bar"); From dd458d1d4e6932bdf4a1e50173808dee65d72ccc Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Tue, 20 Sep 2011 15:28:07 -0700 Subject: [PATCH 2/5] Removing the deprecated $.fixedToolbars property in preparation for jQM 1.0. --- js/jquery.mobile.fixHeaderFooter.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/jquery.mobile.fixHeaderFooter.js b/js/jquery.mobile.fixHeaderFooter.js index 08ae5e68..5aca7d7c 100644 --- a/js/jquery.mobile.fixHeaderFooter.js +++ b/js/jquery.mobile.fixHeaderFooter.js @@ -351,9 +351,6 @@ $.mobile.fixedToolbars = (function() { }; })(); -// TODO - Deprecated namepace on $. Remove in a later release -$.fixedToolbars = $.mobile.fixedToolbars; - //auto self-init widgets $( document ).bind( "pagecreate create", function( event ) { From 14bafc510d096e0c88159f0047dc1b113fc99801 Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Tue, 20 Sep 2011 15:40:52 -0700 Subject: [PATCH 3/5] Removed support for the alpha signature of $.mobile.changePage() in preparation for jQM 1.0. Folks now how to use the signature that requires the toPage (url or element) as the first arg, and options object as the 2nd. --- js/jquery.mobile.navigation.js | 37 ---------------------------------- 1 file changed, 37 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 4de284e3..415019ba 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -862,43 +862,6 @@ // Show a specific page in the page container. $.mobile.changePage = function( toPage, options ) { - // XXX: REMOVE_BEFORE_SHIPPING_1.0 - // This is temporary code that makes changePage() compatible with previous alpha versions. - if ( typeof options !== "object" ) { - var opts = null; - - // Map old-style call signature for form submit to the new options object format. - if ( typeof toPage === "object" && toPage.url && toPage.type ) { - opts = { - type: toPage.type, - data: toPage.data, - forcePageLoad: true - }; - toPage = toPage.url; - } - - // The arguments passed into the function need to be re-mapped - // to the new options object format. - var len = arguments.length; - if ( len > 1 ) { - var argNames = [ "transition", "reverse", "changeHash", "fromHashChange" ], i; - for ( i = 1; i < len; i++ ) { - var a = arguments[ i ]; - if ( typeof a !== "undefined" ) { - opts = opts || {}; - opts[ argNames[ i - 1 ] ] = a; - } - } - } - - // If an options object was created, then we know changePage() was called - // with an old signature. - if ( opts ) { - return $.mobile.changePage( toPage, opts ); - } - } - // XXX: REMOVE_BEFORE_SHIPPING_1.0 - // If we are in the midst of a transition, queue the current request. // We'll call changePage() once we're done with the current transition to // service the request. From e7a33dbb45608c4335cb092b8327aaf13efdf05c Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Tue, 20 Sep 2011 16:15:44 -0700 Subject: [PATCH 4/5] Removed deprecated navigation related properties: $.mobile.updateHash $.mobile.urlstack in preparation for jQM 1.0. --- js/jquery.mobile.navigation.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 415019ba..cf1091ea 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -566,20 +566,12 @@ } }; - //update location.hash, with or without triggering hashchange event - //TODO - deprecate this one at 1.0 - $.mobile.updateHash = path.set; - //expose path object on $.mobile $.mobile.path = path; //expose base object on $.mobile $.mobile.base = base; - //url stack, useful when plugins need to be aware of previous pages viewed - //TODO: deprecate this one at 1.0 - $.mobile.urlstack = urlHistory.stack; - //history stack $.mobile.urlHistory = urlHistory; From 9b0bf5252d36fab398d76b3adc61a80a16b0a49f Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Tue, 20 Sep 2011 16:59:30 -0700 Subject: [PATCH 5/5] Removed deprecated "beforechangepage", "changepage", and "changepagefailed" event references in preparation for jQM 1.0 release. Updated the unit tests to use "pagechange" event instead of "changepage". --- .../dynamic-samples/sample-reuse-page-external.html | 6 +++--- docs/pages/dynamic-samples/sample-reuse-page.html | 6 +++--- docs/pages/page-dynamic.html | 6 +++--- js/jquery.mobile.navigation.js | 13 +++---------- tests/jquery.testHelper.js | 4 ++-- tests/unit/navigation/navigation_base.js | 2 +- tests/unit/navigation/navigation_core.js | 4 ++-- tests/unit/navigation/navigation_helpers.js | 2 +- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/docs/pages/dynamic-samples/sample-reuse-page-external.html b/docs/pages/dynamic-samples/sample-reuse-page-external.html index 4ade5896..39f37bf6 100644 --- a/docs/pages/dynamic-samples/sample-reuse-page-external.html +++ b/docs/pages/dynamic-samples/sample-reuse-page-external.html @@ -74,9 +74,9 @@ function showCategory( url, options ) } -// Listen for any attempts to call changepage. +// Listen for any attempts to call changePage(). $(document).bind( "pagebeforechange", function( e, data ) { - // We only want to handle changepage calls where the caller is + // We only want to handle changePage() calls where the caller is // asking us to load a page by URL. if ( typeof data.toPage === "string" ) { // We are being asked to load a page by URL, but we only @@ -89,7 +89,7 @@ $(document).bind( "pagebeforechange", function( e, data ) { // on the fly based on our in-memory category data structure. showCategory( u.href, data.options ); - // Make sure to tell changepage we've handled this call so it doesn't + // Make sure to tell changePage() we've handled this call so it doesn't // have to do anything. e.preventDefault(); } diff --git a/docs/pages/dynamic-samples/sample-reuse-page.html b/docs/pages/dynamic-samples/sample-reuse-page.html index 0f7e9297..92345811 100644 --- a/docs/pages/dynamic-samples/sample-reuse-page.html +++ b/docs/pages/dynamic-samples/sample-reuse-page.html @@ -148,9 +148,9 @@ function showCategory( urlObj, options ) } -// Listen for any attempts to call changepage. +// Listen for any attempts to call changePage(). $(document).bind( "pagebeforechange", function( e, data ) { - // We only want to handle changepage calls where the caller is + // We only want to handle changePage() calls where the caller is // asking us to load a page by URL. if ( typeof data.toPage === "string" ) { // We are being asked to load a page by URL, but we only @@ -164,7 +164,7 @@ $(document).bind( "pagebeforechange", function( e, data ) { // on the fly based on our in-memory category data structure. showCategory( u, data.options ); - // Make sure to tell changepage we've handled this call so it doesn't + // Make sure to tell changePage() we've handled this call so it doesn't // have to do anything. e.preventDefault(); } diff --git a/docs/pages/page-dynamic.html b/docs/pages/page-dynamic.html index 9e3c2b2f..81006821 100644 --- a/docs/pages/page-dynamic.html +++ b/docs/pages/page-dynamic.html @@ -124,10 +124,10 @@ var categoryData = {

The application was able to insert itself into the changePage() flow by binding to the "pagebeforechange" event at the document level:

 
-// Listen for any attempts to call changepage.
+// Listen for any attempts to call changePage().
 $(document).bind( "pagebeforechange", function( e, data ) {
 
-	// We only want to handle changepage calls where the caller is
+	// We only want to handle changePage() calls where the caller is
 	// asking us to load a page by URL.
 	if ( typeof data.toPage === "string" ) {
 
@@ -144,7 +144,7 @@ $(document).bind( "pagebeforechange", function( e, data ) {
 			// on the fly based on our in-memory category data structure.
 			showCategory( u, data.options );
 
-			// Make sure to tell changepage we've handled this call so it doesn't
+			// Make sure to tell changePage() we've handled this call so it doesn't
 			// have to do anything.
 			e.preventDefault();
 		}
diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js
index cf1091ea..9186abdd 100755
--- a/js/jquery.mobile.navigation.js
+++ b/js/jquery.mobile.navigation.js
@@ -428,8 +428,8 @@
 	})( true );
 
 	// to get last scroll, we need to get scrolltop before the page change
-	// using beforechangepage or popstate/hashchange (whichever comes first)
-	$( document ).bind( "beforechangepage", getLastScroll );
+	// using pagebeforechange or popstate/hashchange (whichever comes first)
+	$( document ).bind( "pagebeforechange", getLastScroll );
 	$( window ).bind( $.support.pushState ? "popstate" : "hashchange", getLastScroll );
 
 	// Make the iOS clock quick-scroll work again if we're using native overflow scrolling
@@ -877,8 +877,6 @@
 		// Let listeners know we're about to change the current page.
 		mpc.trigger( pbcEvent, triggerData );
 
-		mpc.trigger( "beforechangepage", triggerData ); // XXX: DEPRECATED for 1.0
-
 		// If the default behavior is prevented, stop here!
 		if( pbcEvent.isDefaultPrevented() ){
 			return;
@@ -907,7 +905,6 @@
 					$.mobile.changePage( newPage, options );
 				})
 				.fail(function( url, options ) {
-					// XXX_jblas: Fire off changepagefailed notificaiton.
 					isPageTransitioning = false;
 
 					//clear out the active button state
@@ -916,7 +913,6 @@
 					//release transition lock so navigation is free again
 					releasePageTransitionLock();
 					settings.pageContainer.trigger( "pagechangefailed", triggerData );
-					settings.pageContainer.trigger( "changepagefailed", triggerData ); // XXX: DEPRECATED for 1.0
 				});
 			return;
 		}
@@ -943,7 +939,6 @@
 		if( fromPage && fromPage[0] === toPage[0] ) {
 			isPageTransitioning = false;
 			mpc.trigger( "pagechange", triggerData );
-			mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
 			return;
 		}
 
@@ -1031,8 +1026,6 @@
 
 				// Let listeners know we're all done changing the current page.
 				mpc.trigger( "pagechange", triggerData );
-
-				mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
 			});
 	};
 
@@ -1289,7 +1282,7 @@
 						isForward: function() { window.history.forward(); }
 					});
 
-					// prevent changepage
+					// prevent changePage()
 					return;
 				} else {
 					// if the current active page is a dialog and we're navigating
diff --git a/tests/jquery.testHelper.js b/tests/jquery.testHelper.js
index e4978bdc..d39ae983 100644
--- a/tests/jquery.testHelper.js
+++ b/tests/jquery.testHelper.js
@@ -88,7 +88,7 @@
 		},
 
 		pageSequence: function(fns){
-			this.eventSequence("changepage", fns);
+			this.eventSequence("pagechange", fns);
 		},
 
 		eventSequence: function(event, fns, timedOut){
@@ -97,7 +97,7 @@
 
 			if( fn === undefined ) return;
 
-			// if a changepage or defined event is never triggered
+			// if a pagechange or defined event is never triggered
 			// continue in the sequence to alert possible failures
 			var warnTimer = setTimeout(function(){
 				self.eventSequence(event, fns, true);
diff --git a/tests/unit/navigation/navigation_base.js b/tests/unit/navigation/navigation_base.js
index 4be3963c..95824ff4 100644
--- a/tests/unit/navigation/navigation_base.js
+++ b/tests/unit/navigation/navigation_base.js
@@ -9,7 +9,7 @@
 		setup: function(){
 			if ( location.hash ) {
 				stop();
-				$(document).one("changepage", function() {
+				$(document).one("pagechange", function() {
 					start();
 				} );
 				location.hash = "";
diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js
index d53e2df5..87dc329c 100644
--- a/tests/unit/navigation/navigation_core.js
+++ b/tests/unit/navigation/navigation_core.js
@@ -21,7 +21,7 @@
 
 				stop();
 
-				$(document).one( "changepage", function() {
+				$(document).one( "pagechange", function() {
 					start();
 				});
 
@@ -197,7 +197,7 @@
 			}], 1000);
 	});
 
-	asyncTest( "forms with data attribute ajax not set or set to anything but false will call changepage", function(){
+	asyncTest( "forms with data attribute ajax not set or set to anything but false will call changePage", function(){
 		var called = 0,
 				newChangePage = function(){
 					called++;
diff --git a/tests/unit/navigation/navigation_helpers.js b/tests/unit/navigation/navigation_helpers.js
index 9ed2baf9..88533b76 100644
--- a/tests/unit/navigation/navigation_helpers.js
+++ b/tests/unit/navigation/navigation_helpers.js
@@ -8,7 +8,7 @@
 		setup: function(){
 			if ( location.hash ) {
 				stop();
-				$(document).one("changepage", function() {
+				$(document).one("pagechange", function() {
 					start();
 				} );
 				location.hash = "";