Skip to content
Browse files

inline attrs()/escape() in the generated function

  • Loading branch information...
1 parent addd110 commit 51cdf627e3daecec3c50599d7f705e6506bfd5b2 @tj tj committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/jade.js
View
8 lib/jade.js
@@ -179,6 +179,8 @@ function parse(str, options){
try {
return new Function('locals', ''
+ + attrs.toString()
+ + escape.toString()
+ 'var buf = [];\n'
+ 'with (locals) {' + js + '}'
+ 'return buf.join("");');
@@ -233,11 +235,9 @@ exports.render = function(str, options){
// Render the template
try {
- var locals = options.locals || {},
- _ = { lineno: 1 };
+ var locals = options.locals || {}
+ , _ = { lineno: 1 };
locals._ = _;
- locals.attrs = attrs;
- locals.escape = escape;
return fn.call(options.scope, locals);
} catch (err) {
rethrow(err, str, filename, _.lineno);

0 comments on commit 51cdf62

Please sign in to comment.
Something went wrong with that request. Please try again.