I\'m using Backbone and therefore Underscore to render my templates. My templates get rendered in tags and then I use jQuery to grab their html. My
You could muck around with prototype.template
by hand and compile the template the first time you create an instance of your view. Something like this:
initialize: function() {
if(!this.constructor.prototype.template)
this.constructor.prototype.template = _.template($("#ItemTemplate").html());
this.render();
}
Demo: http://jsfiddle.net/ambiguous/e6y3F/
The trick is to get your hands on the right prototype
.