documentcloud/backbone — Issue #900: Bind multiple actions to one route
Author: DreamTheater
Created: 2012-01-30 15:06:08+00:00
State: open

Backbone registers all routes, but calls only last handler. It can be fixed if override Backbone.History.prototype.loadUrl method:

Backbone.History.prototype.loadUrl = function (fragment) {
this.fragment = this.getFragment(fragment);

return !_.chain(this.handlers).filter(function (handler) {
return handler.route.test(this.fragment);
}, this).each(function (handler) {
handler.callback(this.fragment);
}, this).isEmpty();
};