This commit is contained in:
Michael Witten 2017-08-26 16:45:09 +00:00 committed by GitHub
commit 616190600a

View file

@ -3282,9 +3282,12 @@ def serializeXML(element, options, ind=0, preserveWhitespace=False):
elif attrValue == 'default':
preserveWhitespace = False
# if no children, self-close
children = element.childNodes
if children.length > 0:
if children.length == 0:
outParts.append('/>')
if indent > 0:
outParts.append(newline)
else:
outParts.append('>')
onNewLine = False
@ -3319,10 +3322,6 @@ def serializeXML(element, options, ind=0, preserveWhitespace=False):
outParts.extend(['</', element.nodeName, '>'])
if indent > 0:
outParts.append(newline)
else:
outParts.append('/>')
if indent > 0:
outParts.append(newline)
return "".join(outParts)