aboutsummaryrefslogtreecommitdiff
path: root/lib/html/index.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-12-10 21:53:24 +0000
committerMichael Williamson <mike@zwobble.org>2016-12-10 21:53:24 +0000
commit0ad3a12213086e433c617fb951edaada6e7500f5 (patch)
tree4770aad36468db9a6c492d9614165739769915d5 /lib/html/index.js
parent72ad04159683e8958ff957695fc9bb224fc376ca (diff)
Remove self-closing tags from AST
Diffstat (limited to 'lib/html/index.js')
-rw-r--r--lib/html/index.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/html/index.js b/lib/html/index.js
index 3b6a190..810ab66 100644
--- a/lib/html/index.js
+++ b/lib/html/index.js
@@ -20,19 +20,18 @@ function writeNode(writer, node) {
var toStrings = {
element: generateElementString,
- selfClosingElement: generateSelfClosingElementString,
text: generateTextString,
forceWrite: function() { }
};
function generateElementString(writer, node) {
- writer.open(node.tag.tagName, node.tag.attributes);
- write(writer, node.children);
- writer.close(node.tag.tagName);
-}
-
-function generateSelfClosingElementString(writer, node) {
- writer.selfClosing(node.tagName, node.attributes);
+ if (ast.isVoidElement(node)) {
+ writer.selfClosing(node.tag.tagName, node.tag.attributes);
+ } else {
+ writer.open(node.tag.tagName, node.tag.attributes);
+ write(writer, node.children);
+ writer.close(node.tag.tagName);
+ }
}
function generateTextString(writer, node) {