sstephenson / eco

Embedded CoffeeScript templates
MIT License
1.71k stars 70 forks source link

Backbone.js and <%= #49

Closed superbobry closed 12 years ago

superbobry commented 12 years ago

Hello, it seems like <%= syntax doesn't work well with Backbone models, when a model is used as template context. For example:

<%= @get("foo") %>

is compiled to:

this.escape(this.get("foo"))

What's wrong with this? A model has an escape() method, which takes attribute name as a single argument, and returns its escaped value. This is obviously not what eco is expecting.

Maybe there's a way to disable this implicit escape() lookup?

sstephenson commented 12 years ago

You should not pass Backbone models as template context objects. See #36.