Skip to content

Commit

Permalink
Transition with search params.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Oct 24, 2014
1 parent eda14bd commit ea9f5b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@
var path = decodeURI(this.location.pathname + this.getSearch());
var root = this.root.slice(0, -1);
if (!path.indexOf(root)) path = path.slice(root.length);
return path.slice(1);
return path.charAt(0) === '/' ? path.slice(1) : path;
},

// Get the cross-browser normalized URL fragment from the path or hash.
Expand Down
16 changes: 16 additions & 0 deletions test/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,4 +908,20 @@
Backbone.history.start();
});

test('#3358 - pushState to hashChange transition with search params', 1, function() {
Backbone.history.stop();
location.replace('/root?foo=bar');
location.replace = function(url) {
strictEqual(url, '/root/#?foo=bar');
};
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
pushState: undefined,
replaceState: undefined
}
});
Backbone.history.start({root: '/root', pushState: true});
});

})();

0 comments on commit ea9f5b8

Please sign in to comment.