documentcloud/backbone — pull request #1238 by sbrekken (2012-04-19 12:55:49+00:00)
Title: Add route chaining

This patch adds the ability to chain route handlers by simply returning a non-false value from a route handler.

Example:

```javascript

var ChainedRouter = Backbone.Router.extend({
routes: {
'frontpage/:item': 'showItem',
'frontpage': 'showFrontpage'
},

showItem: function(item) {
console.log('Showing item:', item);

this.model.set({item: item});

return true;
},

showFrontpage: function() {
console.log('Showing frontpage');

this.model.set({view: 'frontpage'});
}
})
```

It doesn't alter the current behavior in any way, tests case attached.

This feature could be expanded to how [express.js does passing of route control](http://expressjs.com/guide.html#passing-route control) by passing a `next` function argument to each handler with optional additional arguments for the next matching handler.