diff --git a/dom.d b/dom.d
index 2ad083b..c28fd46 100644
--- a/dom.d
+++ b/dom.d
@@ -3520,7 +3520,7 @@ class Element : DomParent {
// for simple `- text
- text
`, let's
// just keep them on the same line
- if(tagName.isInArray(inlineElements) || allAreInlineHtml(children, inlineElements)) {
+ if(isEmpty || tagName.isInArray(inlineElements) || allAreInlineHtml(children, inlineElements)) {
foreach(child; children) {
s ~= child.toString();//toPrettyString(false, 0, null);
}
@@ -7827,7 +7827,7 @@ bool allAreInlineHtml(const(Element)[] children, const string[] inlineElements)
foreach(child; children) {
if(child.nodeType == NodeType.Text && child.nodeValue.strip.length) {
// cool
- } else if(child.tagName.isInArray(inlineElements) && allAreInlineHtml(child.children, inlineElements)) {
+ } else if(child.isEmpty || child.tagName.isInArray(inlineElements) && allAreInlineHtml(child.children, inlineElements)) {
// cool
} else {
// prolly block
@@ -8003,6 +8003,7 @@ unittest {
// despite these being in a test, I might change these anyway!
assert(Element.make("a").toPrettyString == "");
assert(Element.make("a", "").toPrettyString(false, 0, " ") == "");
+ assert(Element.make("a", " ").toPrettyString(false, 0, " ") == " ");//, Element.make("a", " ").toPrettyString(false, 0, " "));
assert(Element.make("a", "b").toPrettyString == "b");
assert(Element.make("a", "b").toPrettyString(false, 0, "") == "b");