Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
compiling now returns a function, rather than an object with render m…
Browse files Browse the repository at this point in the history
…ethod
  • Loading branch information
tenorviol committed Oct 3, 2011
1 parent 76d8722 commit c4a8feb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/xjs.js
Expand Up @@ -68,8 +68,7 @@ function interpret(source) {

function interpretTree(js, tree, tab) {
js.push(
tab + '({',
tab + ' render: function(out, local) {',
tab + ' function(out, local) {',
tab + ' var end = false;',
tab + ' if (Object.getPrototypeOf(out) !== module.xjs.XjsStream.prototype) {',
tab + ' out = new module.xjs.XjsStream(out);',
Expand All @@ -91,8 +90,7 @@ function interpretTree(js, tree, tab) {
tab + ' if (end) {',
tab + ' out.end();',
tab + ' }',
tab + ' }',
tab + '})'
tab + ' }'
);
return js.join('\n');
}
Expand Down
2 changes: 1 addition & 1 deletion test/xjs.test.js
Expand Up @@ -239,7 +239,7 @@ tests.forEach(function(test) {

exports['render ' + test.source] = function(assert) {
var template = xjs.parse(test.source);
template.render(function(result) {
template(function(result) {
assert.equal(test.render, result);
assert.done();
}, test.local);
Expand Down
2 changes: 1 addition & 1 deletion test/xjsModules.test.js
Expand Up @@ -46,7 +46,7 @@ tests.forEach(function(test) {

exports['render ' + test.filename] = function(assert) {
var template = require(test.filename);
template.render(function(result) {
template(function(result) {
assert.equal(test.render, result);
assert.done();
}, test.local);
Expand Down

0 comments on commit c4a8feb

Please sign in to comment.