A fellow front-end dev posed to me this inquiry, and I wasn't exactly sure how to articulate my stance, but he got me thinking:
So, the convention in Backbone (or Backbone.Marionette) is to render a view, which is associated with a template, and then dump or append the resultant view's constructed/composited HTML into an existing container, as such:
this.$el.append(this.subview.render().$el);
However, this, of course, requires a DOM element on the page, which has already been rendered, to dump this newly-rendered view into. This results in phenomenons like the following:
<ul id="scheduler-loadroutegroups" class="full-height"></ul>
or
collectionView.$("#scheduler-loadroutegroups").append(itemView.el);
That is, empty containers which eventually expect content.
Obviously, this render-and-append pattern is a core concept of Backbone, and having containers to place content into seems to be absolutely essential.
My coworker's question was whether it would be possible to utilize a more server-side MVC template pattern, in which you wouldn't need ANY empty containers:
<ul id="scheduler-loadroutegroups" class="full-height">
{{#developers}}
<ul>
{{#pets}}
<li>{{name}}</li>
{{/pets}}
</ul>
{{/developers}}
</ul>
In this instance, say developers represent a collection of models, and pets represent a collection of models. They each would need their own view/subview, with events attached to them.
I'm under the assumption that the issue with a more classical server-side MVC templating system is that the views and their related templates would then be missing the fine-grained control over context limiting and event binding that Backbone relies on.
All Backbone examples/documentation I've seen use this "empty container/append" pattern. Is it possible to do things any other way? Why or why not?