Permalink
Browse files

Navigation: changePage: Re-examine whether toPage is a string after h…

…aving issued pageBeforeChange, because the handler might have replaced a jQuery object with a string (in the case of a redirect)
  • Loading branch information...
1 parent f8a048e commit 08ea30eedb477fe3ec97ab646f9c1dda95c832f2 @gabrielschulhof gabrielschulhof committed Dec 17, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/jquery.mobile.navigation.js
@@ -656,16 +656,19 @@ define( [
// Let listeners know we're about to change the current page.
mpc.trigger( pbcEvent, triggerData );
-
// If the default behavior is prevented, stop here!
if ( pbcEvent.isDefaultPrevented() ) {
return;
}
// We allow "pagebeforechange" observers to modify the toPage in the trigger
// data to allow for redirects. Make sure our toPage is updated.
+ //
+ // We also need to re-evaluate whether it is a string, because an object can
+ // also be replaced by a string
toPage = triggerData.toPage;
+ isToPageString = (typeof toPage === "string");
// Set the isPageTransitioning flag to prevent any requests from
// entering this method while we are in the midst of loading a page

0 comments on commit 08ea30e

Please sign in to comment.