Skip to content

Commit 9b0bf52

Browse files
committed
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".
1 parent e7a33db commit 9b0bf52

File tree

8 files changed

+18
-25
lines changed

8 files changed

+18
-25
lines changed

docs/pages/dynamic-samples/sample-reuse-page-external.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474
}
7575

7676

77-
// Listen for any attempts to call changepage.
77+
// Listen for any attempts to call changePage().
7878
$(document).bind( "pagebeforechange", function( e, data ) {
79-
// We only want to handle changepage calls where the caller is
79+
// We only want to handle changePage() calls where the caller is
8080
// asking us to load a page by URL.
8181
if ( typeof data.toPage === "string" ) {
8282
// We are being asked to load a page by URL, but we only
@@ -89,7 +89,7 @@
8989
// on the fly based on our in-memory category data structure.
9090
showCategory( u.href, data.options );
9191

92-
// Make sure to tell changepage we've handled this call so it doesn't
92+
// Make sure to tell changePage() we've handled this call so it doesn't
9393
// have to do anything.
9494
e.preventDefault();
9595
}

docs/pages/dynamic-samples/sample-reuse-page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@
148148
}
149149

150150

151-
// Listen for any attempts to call changepage.
151+
// Listen for any attempts to call changePage().
152152
$(document).bind( "pagebeforechange", function( e, data ) {
153-
// We only want to handle changepage calls where the caller is
153+
// We only want to handle changePage() calls where the caller is
154154
// asking us to load a page by URL.
155155
if ( typeof data.toPage === "string" ) {
156156
// We are being asked to load a page by URL, but we only
@@ -164,7 +164,7 @@
164164
// on the fly based on our in-memory category data structure.
165165
showCategory( u, data.options );
166166

167-
// Make sure to tell changepage we've handled this call so it doesn't
167+
// Make sure to tell changePage() we've handled this call so it doesn't
168168
// have to do anything.
169169
e.preventDefault();
170170
}

docs/pages/page-dynamic.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ <h2>jQuery Mobile and Dynamic Page Generation</h2>
124124
<p>The application was able to insert itself into the changePage() flow by binding to the &quot;pagebeforechange&quot; event at the document level:</p>
125125
<pre>
126126
<code>
127-
// Listen for any attempts to call changepage.
127+
// Listen for any attempts to call changePage().
128128
$(document).bind( &quot;pagebeforechange&quot;, function( e, data ) {
129129

130-
// We only want to handle changepage calls where the caller is
130+
// We only want to handle changePage() calls where the caller is
131131
// asking us to load a page by URL.
132132
if ( typeof data.toPage === &quot;string&quot; ) {
133133

@@ -144,7 +144,7 @@ <h2>jQuery Mobile and Dynamic Page Generation</h2>
144144
// on the fly based on our in-memory category data structure.
145145
showCategory( u, data.options );
146146

147-
// Make sure to tell changepage we've handled this call so it doesn't
147+
// Make sure to tell changePage() we've handled this call so it doesn't
148148
// have to do anything.
149149
e.preventDefault();
150150
}

js/jquery.mobile.navigation.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@
428428
})( true );
429429

430430
// to get last scroll, we need to get scrolltop before the page change
431-
// using beforechangepage or popstate/hashchange (whichever comes first)
432-
$( document ).bind( "beforechangepage", getLastScroll );
431+
// using pagebeforechange or popstate/hashchange (whichever comes first)
432+
$( document ).bind( "pagebeforechange", getLastScroll );
433433
$( window ).bind( $.support.pushState ? "popstate" : "hashchange", getLastScroll );
434434

435435
// Make the iOS clock quick-scroll work again if we're using native overflow scrolling
@@ -877,8 +877,6 @@
877877
// Let listeners know we're about to change the current page.
878878
mpc.trigger( pbcEvent, triggerData );
879879

880-
mpc.trigger( "beforechangepage", triggerData ); // XXX: DEPRECATED for 1.0
881-
882880
// If the default behavior is prevented, stop here!
883881
if( pbcEvent.isDefaultPrevented() ){
884882
return;
@@ -907,7 +905,6 @@
907905
$.mobile.changePage( newPage, options );
908906
})
909907
.fail(function( url, options ) {
910-
// XXX_jblas: Fire off changepagefailed notificaiton.
911908
isPageTransitioning = false;
912909

913910
//clear out the active button state
@@ -916,7 +913,6 @@
916913
//release transition lock so navigation is free again
917914
releasePageTransitionLock();
918915
settings.pageContainer.trigger( "pagechangefailed", triggerData );
919-
settings.pageContainer.trigger( "changepagefailed", triggerData ); // XXX: DEPRECATED for 1.0
920916
});
921917
return;
922918
}
@@ -943,7 +939,6 @@
943939
if( fromPage && fromPage[0] === toPage[0] ) {
944940
isPageTransitioning = false;
945941
mpc.trigger( "pagechange", triggerData );
946-
mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
947942
return;
948943
}
949944

@@ -1031,8 +1026,6 @@
10311026

10321027
// Let listeners know we're all done changing the current page.
10331028
mpc.trigger( "pagechange", triggerData );
1034-
1035-
mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
10361029
});
10371030
};
10381031

@@ -1289,7 +1282,7 @@
12891282
isForward: function() { window.history.forward(); }
12901283
});
12911284

1292-
// prevent changepage
1285+
// prevent changePage()
12931286
return;
12941287
} else {
12951288
// if the current active page is a dialog and we're navigating

tests/jquery.testHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
},
8989

9090
pageSequence: function(fns){
91-
this.eventSequence("changepage", fns);
91+
this.eventSequence("pagechange", fns);
9292
},
9393

9494
eventSequence: function(event, fns, timedOut){
@@ -97,7 +97,7 @@
9797

9898
if( fn === undefined ) return;
9999

100-
// if a changepage or defined event is never triggered
100+
// if a pagechange or defined event is never triggered
101101
// continue in the sequence to alert possible failures
102102
var warnTimer = setTimeout(function(){
103103
self.eventSequence(event, fns, true);

tests/unit/navigation/navigation_base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
setup: function(){
1010
if ( location.hash ) {
1111
stop();
12-
$(document).one("changepage", function() {
12+
$(document).one("pagechange", function() {
1313
start();
1414
} );
1515
location.hash = "";

tests/unit/navigation/navigation_core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
stop();
2323

24-
$(document).one( "changepage", function() {
24+
$(document).one( "pagechange", function() {
2525
start();
2626
});
2727

@@ -197,7 +197,7 @@
197197
}], 1000);
198198
});
199199

200-
asyncTest( "forms with data attribute ajax not set or set to anything but false will call changepage", function(){
200+
asyncTest( "forms with data attribute ajax not set or set to anything but false will call changePage", function(){
201201
var called = 0,
202202
newChangePage = function(){
203203
called++;

tests/unit/navigation/navigation_helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
setup: function(){
99
if ( location.hash ) {
1010
stop();
11-
$(document).one("changepage", function() {
11+
$(document).one("pagechange", function() {
1212
start();
1313
} );
1414
location.hash = "";

0 commit comments

Comments
 (0)