Skip to content

Commit

Permalink
first draft of splatted params.
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Nov 8, 2010
1 parent bdee3a2 commit 37cd991
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backbone.js
Expand Up @@ -574,7 +574,7 @@
};

var namedParam = /:([\w\d]+)/g;
var paramMatch = "([^\/]+)";
var splatParam = /\*([\w\d]+)/g;

// Set up all inheritable **Backbone.Controller** properties and methods.
_.extend(Backbone.Controller.prototype, Backbone.Events, {
Expand Down Expand Up @@ -603,7 +603,8 @@
},

_routeToRegExp : function(route) {
return new RegExp('^#' + route.replace(namedParam, paramMatch) + '$');
route = route.replace(namedParam, "([^\/]*)").replace(splatParam, "(.*?)");
return new RegExp('^#' + route + '$');
},

_extractArguments : function(route, fragment) {
Expand Down

0 comments on commit 37cd991

Please sign in to comment.