Leave out unnecessary trailing slash.

This commit is contained in:
Brad Dunbar
2014-11-26 16:49:50 -05:00
parent 62b1f25aec
commit 7e67491049
2 changed files with 4 additions and 3 deletions

View File

@@ -1481,7 +1481,8 @@
// 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...
if (!this._hasPushState && !this.atRoot()) {
this.location.replace(this.root + '#' + this.getPath());
var root = this.root.slice(0, -1) || '/';
this.location.replace(root + '#' + this.getPath());
// Return immediately as browser will do redirect to new url
return true;

View File

@@ -565,7 +565,7 @@
Backbone.history.stop();
location.replace('http://example.com/root/x/y?a=b');
location.replace = function(url) {
strictEqual(url, '/root/#x/y?a=b');
strictEqual(url, '/root#x/y?a=b');
};
Backbone.history = _.extend(new Backbone.History, {
location: location,
@@ -904,7 +904,7 @@
Backbone.history.stop();
location.replace('/root?foo=bar');
location.replace = function(url) {
strictEqual(url, '/root/#?foo=bar');
strictEqual(url, '/root#?foo=bar');
};
Backbone.history = _.extend(new Backbone.History, {
location: location,