Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 08ea30e

Browse files
author
Gabriel Schulhof
committed
Navigation: changePage: Re-examine whether toPage is a string after having issued pageBeforeChange, because the handler might have replaced a jQuery object with a string (in the case of a redirect)
1 parent f8a048e commit 08ea30e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

js/jquery.mobile.navigation.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,16 +656,19 @@ define( [
656656
// Let listeners know we're about to change the current page.
657657
mpc.trigger( pbcEvent, triggerData );
658658

659-
660659
// If the default behavior is prevented, stop here!
661660
if ( pbcEvent.isDefaultPrevented() ) {
662661
return;
663662
}
664663

665664
// We allow "pagebeforechange" observers to modify the toPage in the trigger
666665
// data to allow for redirects. Make sure our toPage is updated.
666+
//
667+
// We also need to re-evaluate whether it is a string, because an object can
668+
// also be replaced by a string
667669

668670
toPage = triggerData.toPage;
671+
isToPageString = (typeof toPage === "string");
669672

670673
// Set the isPageTransitioning flag to prevent any requests from
671674
// entering this method while we are in the midst of loading a page

0 commit comments

Comments
 (0)