summaryrefslogtreecommitdiffstats
path: root/spec/env/browser.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-10-14 22:49:23 -0500
committerkpdecker <kpdecker@gmail.com>2013-10-14 22:49:23 -0500
commit6f94fc0a3be36bd32babd70680bfcb1195dafc30 (patch)
tree818a3c5a5673b94b18011014cff76abc6a235511 /spec/env/browser.js
parent84049bf0c5576727e9d6a0880abb123454d28861 (diff)
downloadhandlebars.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.js7
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 + ')');
+}