aboutsummaryrefslogtreecommitdiff
path: root/lib/html/simplify.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/simplify.js
parent72ad04159683e8958ff957695fc9bb224fc376ca (diff)
Remove self-closing tags from AST
Diffstat (limited to 'lib/html/simplify.js')
-rw-r--r--lib/html/simplify.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/html/simplify.js b/lib/html/simplify.js
index e05bde2..8ba37eb 100644
--- a/lib/html/simplify.js
+++ b/lib/html/simplify.js
@@ -21,7 +21,6 @@ function collapseNode(node) {
var collapsers = {
element: collapseElement,
- selfClosingElement: identity,
text: identity,
forceWrite: identity
};
@@ -61,7 +60,6 @@ function flatMap(values, func) {
var emptiers = {
element: elementEmptier,
- selfClosingElement: neverEmpty,
text: textEmptier,
forceWrite: neverEmpty
};
@@ -72,10 +70,10 @@ function neverEmpty(node) {
function elementEmptier(element) {
var children = removeEmpty(element.children);
- if (children.length === 0) {
+ if (children.length === 0 && !ast.isVoidElement(element)) {
return [];
} else {
- return ast.elementWithTag(element.tag, children);
+ return [ast.elementWithTag(element.tag, children)];
}
}