Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support the use of the query string (location.search) for routing.

  • Loading branch information...
commit f32d6405d09e6734de8d4f889fc37146c8934f5a 1 parent 907f601
@fblee fblee authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 js/lib/router.js
View
6 js/lib/router.js
@@ -225,7 +225,7 @@ _.extend(History.prototype, /*Events,*/ {
// opened by a non-pushState browser.
this.fragment = fragment;
var loc = window.location;
- var atRoot = loc.pathname === this.options.root;
+ var atRoot = (loc.pathname + loc.search) === this.options.root;
// If we've started off with a route from a `pushState`-enabled browser,
// but we're currently in a browser that doesn't support it...
@@ -243,8 +243,8 @@ _.extend(History.prototype, /*Events,*/ {
}
// Workaround the root having a trailing slash when the visited URL is misisng it.
- if (this._wantsPushState && this._hasPushState && this.options.root === ('/' + this.fragment + '/')) {
- window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root);
+ if (this._wantsPushState && this._hasPushState && this.options.root === (loc.pathname + '/')) {
+ window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + loc.search);
}
if (!this.options.silent) {
Please sign in to comment.
Something went wrong with that request. Please try again.