Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backbone.subroute.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
// a user directly navigates to a URL with a subroute on the first page load.
// Check every element, if one matches, break. Prevent multiple matches
_.every(this.routes, function(key, route) {

if (route.substr(0, 1) != '/' &&
route.indexOf(this.prefix.substr(0, this.prefix.length - 1)) !== 0) {

route = this.prefix +
(route ? this.separator : "") +
route;
}
// Use the Backbone parser to turn route into regex for matching
if (hash.match(Backbone.Router.prototype._routeToRegExp(route))) {
Backbone.history.loadUrl(hash);
Expand Down