options.scope no longer has effect in render #122

Open
hpaulj opened this Issue Jun 18, 2013 · 1 comment

Comments

Projects
None yet
1 participant

hpaulj commented Jun 18, 2013

In ejs@0.8.3

test='this test in base'
console.log(ejs.render('<%= this.test %>'))
console.log(ejs.render('<%= this.test %>',{scope:{test:'in scope'}}))

produces

this test in base
in scope

in ejs@0.8.4, both lines produce this test in base

This appears to be the result of visionmedia#79 which wraps the template code in a function(){...}().

Using option._with:false, gets around this problem

hpaulj commented Jun 21, 2013

I think this issue would be resolved by changing the template compile to produce

(function(){...}).call(this)

In other words, pass the scope through the new function layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment