From d60289c50f52d8fea3bf3b5a7b8dfe0c33bc1a22 Mon Sep 17 00:00:00 2001 From: Patrick Steele-Idem Date: Tue, 10 Nov 2015 10:21:02 -0700 Subject: [PATCH] Fixes #161 - Nested tags with no body content are not handled correctly --- taglibs/core/TagHandlerNode.js | 6 ++++++ .../fixtures/templates/nested-tags-empty-body/expected.html | 2 +- .../templates/nested-tags-self-closing/expected.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/taglibs/core/TagHandlerNode.js b/taglibs/core/TagHandlerNode.js index 3d2fb9ce8..0ca55ffda 100644 --- a/taglibs/core/TagHandlerNode.js +++ b/taglibs/core/TagHandlerNode.js @@ -267,7 +267,10 @@ TagHandlerNode.prototype = { var hasOutParam = false; + var hasBodyFunc = false; + if (_this.hasChildren() && !tag.bodyFunction) { + hasBodyFunc = true; var bodyParams = []; @@ -296,6 +299,9 @@ TagHandlerNode.prototype = { } if (hasNestedTags || isNestedTag || hasOutParam) { + if (!hasBodyFunc) { + template.code(',null'); + } var options = []; if (hasNestedTags) { diff --git a/test/fixtures/templates/nested-tags-empty-body/expected.html b/test/fixtures/templates/nested-tags-empty-body/expected.html index bfff9f5dc..1d4d1d228 100644 --- a/test/fixtures/templates/nested-tags-empty-body/expected.html +++ b/test/fixtures/templates/nested-tags-empty-body/expected.html @@ -1 +1 @@ -
Tab 1 content
Tab 3 content
\ No newline at end of file +
Tab 1 content
Tab 3 content
\ No newline at end of file diff --git a/test/fixtures/templates/nested-tags-self-closing/expected.html b/test/fixtures/templates/nested-tags-self-closing/expected.html index bfff9f5dc..1d4d1d228 100644 --- a/test/fixtures/templates/nested-tags-self-closing/expected.html +++ b/test/fixtures/templates/nested-tags-self-closing/expected.html @@ -1 +1 @@ -
Tab 1 content
Tab 3 content
\ No newline at end of file +
Tab 1 content
Tab 3 content
\ No newline at end of file