summaryrefslogtreecommitdiffstats
path: root/lib/rexml/element.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/element.rb')
-rw-r--r--lib/rexml/element.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index aba57d708..40cac168b 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -635,7 +635,12 @@ module REXML
end unless @attributes.empty?
if @children.empty?
- writer << " " if ie_hack
+ if transitive and indent>-1
+ writer << "\n"
+ indent( writer, indent )
+ elsif ie_hack
+ writer << " "
+ end
writer << "/"
else
if transitive and indent>-1 and !@children[0].kind_of? Text
@@ -646,7 +651,7 @@ module REXML
write_children( writer, indent, transitive, ie_hack )
writer << "</#{expanded_name}"
end
- if transitive and indent>-1
+ if transitive and indent>-1 and !@children.empty?
writer << "\n"
indent -= 1 if next_sibling.nil?
indent(writer, indent)