scour.py: minor rearrangement for the sake of clarity
There has been a minor rearrangement of the code that handles the children of the element being serialized: The relevant `if' statement has had its condition effectively negated and thus has also had its consequent and alternative swapped; now, there is a very short consequent, followed by a very long alternative, rather than a very long consequent followed by a very short alternative.
This commit is contained in:
parent
fdbf890ba8
commit
942762b5cd
1 changed files with 5 additions and 6 deletions
|
|
@ -3282,9 +3282,12 @@ def serializeXML(element, options, ind=0, preserveWhitespace=False):
|
||||||
elif attrValue == 'default':
|
elif attrValue == 'default':
|
||||||
preserveWhitespace = False
|
preserveWhitespace = False
|
||||||
|
|
||||||
# if no children, self-close
|
|
||||||
children = element.childNodes
|
children = element.childNodes
|
||||||
if children.length > 0:
|
if children.length == 0:
|
||||||
|
outParts.append('/>')
|
||||||
|
if indent > 0:
|
||||||
|
outParts.append(newline)
|
||||||
|
else:
|
||||||
outParts.append('>')
|
outParts.append('>')
|
||||||
|
|
||||||
onNewLine = False
|
onNewLine = False
|
||||||
|
|
@ -3319,10 +3322,6 @@ def serializeXML(element, options, ind=0, preserveWhitespace=False):
|
||||||
outParts.extend(['</', element.nodeName, '>'])
|
outParts.extend(['</', element.nodeName, '>'])
|
||||||
if indent > 0:
|
if indent > 0:
|
||||||
outParts.append(newline)
|
outParts.append(newline)
|
||||||
else:
|
|
||||||
outParts.append('/>')
|
|
||||||
if indent > 0:
|
|
||||||
outParts.append(newline)
|
|
||||||
|
|
||||||
return "".join(outParts)
|
return "".join(outParts)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue