Merge pull request #414 from vincentbernat/fix/no-eval
jade: avoid using eval once compiled
This commit is contained in:
commit
3754ba7596
@ -7,6 +7,9 @@ define(["libjs-jade-runtime", "app/utils", "jade!app/text/postbox", "jade!app/te
|
||||
var load = function(name, js) {
|
||||
templates[name] = (function(jade) {
|
||||
var fn;
|
||||
if (js.compiled) {
|
||||
return js(jade);
|
||||
}
|
||||
eval("fn = " + js);
|
||||
return fn;
|
||||
})(runtime);
|
||||
|
@ -49,8 +49,12 @@ define(function() {
|
||||
write: function(plugin, name, write) {
|
||||
if (builds.hasOwnProperty(name)) {
|
||||
write("define('" + plugin + "!" + name +"', function () {" +
|
||||
" var fn = " + builds[name] + ";" +
|
||||
" return fn;" +
|
||||
" var wfn = function (jade) {" +
|
||||
" var fn = " + builds[name] + ";" +
|
||||
" return fn;" +
|
||||
" };" +
|
||||
"wfn.compiled = true;" +
|
||||
"return wfn;" +
|
||||
"});\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user