diff options
author | kpdecker <kpdecker@gmail.com> | 2013-10-14 22:49:23 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-10-14 22:49:23 -0500 |
commit | 6f94fc0a3be36bd32babd70680bfcb1195dafc30 (patch) | |
tree | 818a3c5a5673b94b18011014cff76abc6a235511 /spec/env/browser.js | |
parent | 84049bf0c5576727e9d6a0880abb123454d28861 (diff) | |
download | handlebars.js-6f94fc0a3be36bd32babd70680bfcb1195dafc30.zip handlebars.js-6f94fc0a3be36bd32babd70680bfcb1195dafc30.tar.gz handlebars.js-6f94fc0a3be36bd32babd70680bfcb1195dafc30.tar.bz2 |
Reduce eval scope in test env
Diffstat (limited to 'spec/env/browser.js')
-rw-r--r-- | spec/env/browser.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/env/browser.js b/spec/env/browser.js index e6f8102..9f69e74 100644 --- a/spec/env/browser.js +++ b/spec/env/browser.js @@ -1,3 +1,4 @@ +/*global handlebarsEnv */ require('./common'); var _ = require('underscore'), @@ -10,9 +11,13 @@ vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.js'), 'd global.CompilerContext = { compile: function(template, options) { var templateSpec = handlebarsEnv.precompile(template, options); - return handlebarsEnv.template(eval('(' + templateSpec + ')')); + return handlebarsEnv.template(safeEval(templateSpec)); }, compileWithPartial: function(template, options) { return handlebarsEnv.compile(template, options); } }; + +function safeEval(templateSpec) { + return eval('(' + templateSpec + ')'); +} |