From 36af20145def6129a73cae6b2b46f51d5f51a84d Mon Sep 17 00:00:00 2001 From: Steve Conover Date: Wed, 8 Dec 2010 11:11:30 -0800 Subject: [PATCH] script tags are non-self-closing by default --- specs/node_spec.js | 5 ++++- specs/template_spec.js | 2 +- src/Node.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/specs/node_spec.js b/specs/node_spec.js index 069594d..2003f4d 100644 --- a/specs/node_spec.js +++ b/specs/node_spec.js @@ -12,9 +12,12 @@ describe("Jaml.Node", function() { toEqual("\n"); }); - it("doesn't self-close for (for example) textarea", function(){ + it("doesn't self-close for (for example) textarea and script", function(){ expect(new Jaml.Node("textarea").render()). toEqual("\n"); + + expect(new Jaml.Node("script").render()). + toEqual("\n"); }); it("doesn't self-close if there are children", function(){ diff --git a/specs/template_spec.js b/specs/template_spec.js index f5c63dd..47cd044 100644 --- a/specs/template_spec.js +++ b/specs/template_spec.js @@ -32,7 +32,7 @@ describe("Jaml.Template", function() { }).render()). toEqual("\n" + " \n" + - " \n \n \n <link/>\n" + " </head>\n" + " <body>\n" + " <div/>\n <p/>\n <span/>\n <a/>\n <img/>\n" + diff --git a/src/Node.js b/src/Node.js index 9474264..a8b2750 100644 --- a/src/Node.js +++ b/src/Node.js @@ -137,7 +137,7 @@ Jaml.Node.prototype = { * @type Array * An array of all tags that should be self closing */ - notSelfClosingTags: ['textarea'] + notSelfClosingTags: ['textarea', 'script'] }; Jaml.TextNode = function(text) {