Skip to content

Commit

Permalink
Merge pull request #52 from Fju/preserveEmpty
Browse files Browse the repository at this point in the history
Allow to set preserveEmpty option
  • Loading branch information
nfarina committed Apr 28, 2017
2 parents 2d44b36 + 5b76bb5 commit 1069072
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/xmldoc.js
Expand Up @@ -175,7 +175,14 @@ XmlElement.prototype.toStringWithIndent = function(indent, options) {

s += indent + "</" + this.name + ">";
}
else s += "/>";
else if (options && options.html) {
var whiteList = ["br", "img", "input", "link", "meta"];
if (whiteList.indexOf(this.name) !== -1) s += "/>";
else s += "></" + this.name + ">";
}
else {
s += "/>";
}

return s;
};
Expand Down

0 comments on commit 1069072

Please sign in to comment.