From 91eb47cc9c8b82bc171f818046c8100e3420a2b2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 10 Apr 2014 14:28:13 +0100 Subject: Indent self-closing elements --- lib/html-writer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/html-writer.js b/lib/html-writer.js index 1b551ed..be35d52 100644 --- a/lib/html-writer.js +++ b/lib/html-writer.js @@ -52,6 +52,11 @@ function prettyWriter() { writer.text(value.replace("\n", "\n" + indentation)); } + function selfClosing(tagName, attributes) { + indent(); + writer.selfClosing(tagName, attributes); + } + function insideIndentedElement() { return stack.length === 0 || indentedElements[stack[stack.length - 1]]; } @@ -70,7 +75,7 @@ function prettyWriter() { open: open, close: close, text: text, - selfClosing: writer.selfClosing, + selfClosing: selfClosing, append: writer.append }; } -- cgit v1.2.3