Skip to content

Commit

Permalink
Do not overwrite this.routes in #_bindRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Jul 7, 2015
1 parent 5f871af commit 60a5e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1477,11 +1477,10 @@
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
var routes = _.result(this, 'routes');
var keys = _.keys(routes);
for (var i = keys.length - 1; i >= 0; i--) {
this.route(keys[i], routes[keys[i]]);
}
},

Expand Down
2 changes: 1 addition & 1 deletion test/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
});

var router = new RouterExtended();
deepEqual({home: "root", index: "index.html", show: "show", search: "search"}, router.routes);
deepEqual({home: "root", index: "index.html", show: "show", search: "search"}, router.routes());
});

test("#2538 - hashChange to pushState only if both requested.", 0, function() {
Expand Down

0 comments on commit 60a5e6e

Please sign in to comment.