mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-24 06:17:55 -05:00
first draft of splatted params.
This commit is contained in:
@@ -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, {
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user