Permalink
Browse files

Corrected first pass at query params to embedded pages

  • Loading branch information...
1 parent ff79b5f commit 70f0c95c0d99ed4cf7830eb3a72610d1bbe10f2b @johnbender johnbender committed Oct 15, 2012
@@ -46,8 +46,8 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// find present pages
var path = $.mobile.path,
$pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" ),
- hash = path.convertUrlToDataUrl( path.parseLocation().hash ),
- hashPage = document.getElementById( hash );
+ hash = path.stripHash( path.stripQueryParams(path.parseLocation().hash) ),
+ hashPage = document.getElementById( hash );
// if no pages are found, create one with body's inner html
if ( !$pages.length ) {
@@ -94,10 +94,15 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
if ( $.mobile.path.isHashValid( location.hash ) ) {
$.mobile.urlHistory.initialDst = hash.replace( "#", "" );
}
- $.mobile.changePage( $.mobile.firstPage, { transition: "none", reverse: true, changeHash: false, fromHashChange: true } );
- }
- // otherwise, trigger a hashchange to load a deeplink
- else {
+
+ $.mobile.changePage( $.mobile.firstPage, {
+ transition: "none",
+ reverse: true,
+ changeHash: false,
+ fromHashChange: true
+ });
+ } else {
+ // otherwise, trigger a hashchange to load a deeplink
$window.trigger( "hashchange", [ true ] );
}
}
@@ -235,6 +235,10 @@ define( [
return url.replace( /^#/, "" );
},
+ stripQueryParams: function( url ) {
+ return url.replace( /\?.*$/, "" );
+ },
+
//remove the preceding hash, any query params, and dialog notations
cleanHash: function( hash ) {
return path.stripHash( hash.replace( /\?.*$/, "" ).replace( dialogHashKey, "" ) );
@@ -378,19 +378,24 @@
stop();
- timeout = setTimeout( start, 2000);
+ timeout = setTimeout( function() {
+ start();
+ throw "navigation reset timed out";
+ }, 5000);
$(document).one( "pagechange", function() {
clearTimeout( timeout );
start();
});
- location.hash = hash ? "#" + hash : "";
+
+ hash = location.hash.replace( "#", "" ) !== url ? url : "";
+ location.hash = hash;
};
// force the page reset for hash based tests
if ( location.hash && !$.support.pushState ) {
- pageReset();
+ pageReset( url );
}
// force the page reset for all pushstate tests
@@ -16,9 +16,7 @@
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../../../external/qunit.js"></script>
- <script type="text/javascript" src="navigation_helpers.js"></script>
<script type="text/javascript" src="navigation_core.js"></script>
- <script type="text/javascript" src="navigation_paths.js"></script>
<script src="../swarminject.js"></script>
</head>
<body>
@@ -60,8 +60,6 @@
asyncTest( "external page is removed from the DOM after pagehide", function(){
$.testHelper.pageSequence([
- navigateTestRoot,
-
function(){
$.mobile.changePage( "external.html" );
},
@@ -91,7 +89,6 @@
$( document ).bind( "pageremove", removeCallback );
$.testHelper.pageSequence([
- navigateTestRoot,
function(){
$.mobile.changePage( "external.html" );
@@ -132,7 +129,6 @@
asyncTest( "external page is cached in the DOM after pagehide", function(){
$.testHelper.pageSequence([
- navigateTestRoot,
function(){
$.mobile.changePage( "cached-external.html" );
@@ -154,7 +150,6 @@
asyncTest( "external page is cached in the DOM after pagehide when option is set globally", function(){
$.testHelper.pageSequence([
- navigateTestRoot,
function(){
$.mobile.page.prototype.options.domCache = true;

0 comments on commit 70f0c95

Please sign in to comment.