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

Commit

Permalink
merge the search params when squashing makes absolutely no sense sinc…
Browse files Browse the repository at this point in the history
…e it ruins the new url
  • Loading branch information
johnbender committed Nov 8, 2012
1 parent 611bb7d commit 143b2b9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions js/navigation/navigate.js
Expand Up @@ -68,28 +68,21 @@ define([
hash = isPath ? path.stripHash(url) : url,
hashUri = path.parseUrl( hash ),
resolutionUrl = isPath ? path.getLocation() : $.mobile.getDocumentUrl(),
passedSearch, currentSearch, mergedSearch, preservedHash;
passedSearch, preservedHash;

// make the hash abolute with the current href
href = path.makeUrlAbsolute( hash, resolutionUrl );

// TODO all this crap is terrible, clean it up
if ( isPath ) {
passedSearch = hashUri.search;
currentSearch = path.parseUrl( resolutionUrl ).search;
mergedSearch = path.mergeSearch( currentSearch, passedSearch );

// if we get a value back from the merged serve prepend a "?"
mergedSearch = mergedSearch ? "?" + mergedSearch : "";

// Get a hash where possible and, as long as it's not a path
// preserve it on the current url
preservedHash = (hashUri.hash || path.parseLocation().hash);
preservedHash = path.isPath( preservedHash ) ? "" : preservedHash;

// reconstruct each of the pieces with the new search string and hash
href = path.parseUrl( href );
href = href.protocol + "//" + href.host + href.pathname + mergedSearch + preservedHash;
href = href.protocol + "//" + href.host + href.pathname + hashUri.search + preservedHash;
href = path.resetUIKeys( href );
}

Expand Down Expand Up @@ -290,7 +283,8 @@ define([
for ( i = 0; i < length; i++ ) {
entry = stack[i];

if ( decodeURIComponent( url ) === decodeURIComponent( entry.url ) ) {
if ( decodeURIComponent(url) === decodeURIComponent(entry.url)
|| decodeURIComponent(url) === decodeURIComponent(entry.hash) ) {
index = i;

if( earlyReturn ) {
Expand Down

0 comments on commit 143b2b9

Please sign in to comment.