Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

options.scope no longer has effect in render #122

Open
hpaulj opened this Issue · 1 comment

1 participant

@hpaulj

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 #79 which wraps the template code in a function(){...}().

Using option._with:false, gets around this problem

@hpaulj

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
Something went wrong with that request. Please try again.