Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use Function instead of eval

  • Loading branch information...
commit 0586582ef10ae6aef90183260ad60b9240127b02 1 parent f25b82f
@jlongster authored
Showing with 2 additions and 5 deletions.
  1. +0 −3  src/compiler.js
  2. +2 −2 src/environment.js
View
3  src/compiler.js
@@ -255,8 +255,6 @@ var Compiler = Object.extend({
frame = new Frame();
- this.emitLine('(function () {');
-
this.emitFuncBegin('root');
this._compileChildren(node, frame);
if(this.isChild) {
@@ -286,7 +284,6 @@ var Compiler = Object.extend({
this.emitLine(name + ': ' + name + ',');
}, this);
this.emitLine('root: root\n};');
- this.emitLine('})()');
},
compile: function (node, frame) {
View
4 src/environment.js
@@ -129,8 +129,8 @@ var Template = Object.extend({
},
_compile: function() {
- var src = compiler.compile(this.tmplSrc, this.env);
- var props = eval(src);
+ var func = new Function(compiler.compile(this.tmplSrc, this.env));
+ var props = func();
this.blocks = this._getBlocks(props);
this.rootRenderFunc = props.root;
Please sign in to comment.
Something went wrong with that request. Please try again.