> This is something that is missing from Backbone
> and it's something that always comes up
... not so much missing as agnostic. You're quite right that subviews always exist in complex applications, but they're best handled in different ways depending on your templating / HTML-generation library of choice, and your app's architecture. Backbone doesn't want to force you to necessarily have a complete static hierarchy of View objects from the root DOM element down to the bottom ... many applications don't need or benefit from it. That said, if you've got a piece of functionality that you think would help with subviews in most Backbone projects, it would make for a great ticket or pull request.
> You would bind the events on the list (just once,
> for all items) and find a way to know on which
> item the event was triggered.
Yep, and Backbone encourages that kind of delegation by default at the view level ... mostly for reasons of statelessness rather than performance. It's awfully nice to know that all of your events are always bound and ready on any given view, regardless of whether or not that view has any HTML yet, or has even been inserted into the DOM yet.
That said, binding to individual elements isn't problematic unless you're truly doing too much of it. 20 songs each with their own bound callbacks would be fine, but 2,000 songs wouldn't be. When to delegate for performance follows the same reasoning as it would in a plain 'ol jQuery app, and is touched on briefly in the FAQ: http://backbonejs.org/#FAQ-tim-toady
For what it's worth, here's an example of a Backbone view that's using delegation and a single event listener as a callback for all of the individual blocks in the charts: http://blog.documentcloud.org/blog/2011/10/entity-charts/
That said, binding to individual elements isn't problematic unless you're truly doing too much of it. 20 songs each with their own bound callbacks would be fine, but 2,000 songs wouldn't be. When to delegate for performance follows the same reasoning as it would in a plain 'ol jQuery app, and is touched on briefly in the FAQ: http://backbonejs.org/#FAQ-tim-toady
For what it's worth, here's an example of a Backbone view that's using delegation and a single event listener as a callback for all of the individual blocks in the charts: http://blog.documentcloud.org/blog/2011/10/entity-charts/