diff --git a/spec/regressions.js b/spec/regressions.js index 44bde81b6..eec5a490b 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -115,5 +115,9 @@ describe('Regressions', function() { it("can pass through an already-compiled AST via compile/precompile", function() { equal(Handlebars.compile(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]))(), 'Hello'); }); + + it("can pass through an empty string", function() { + equal(Handlebars.compile('')(), ''); + }); } }); diff --git a/src/handlebars.yy b/src/handlebars.yy index 0afd2cbbc..71a857546 100644 --- a/src/handlebars.yy +++ b/src/handlebars.yy @@ -17,6 +17,7 @@ function stripFlags(open, close) { root : statements EOF { return new yy.ProgramNode($1); } + | EOF { return new yy.ProgramNode([]); } ; program