Fix whitespace collapsing when it shouldn't on non-textual elements that have xml:space=preserve

This commit is contained in:
JSCHILL1 2009-11-06 17:21:57 -06:00
parent 6482314390
commit 99dfb0f819
4 changed files with 17 additions and 3 deletions

View file

@ -2098,8 +2098,7 @@ def serializeXML(element, options, ind = 0, preserveWhitespace = False):
elif child.nodeType == 3:
# trim it only in the case of not being a child of an element
# where whitespace might be important
if element.nodeName in ["text", "tspan", "textPath", "tref", "title", "desc", "textArea",
"flowRoot", "flowDiv", "flowSpan", "flowPara", "flowRegion"]:
if preserveWhitespace:
outString += makeWellFormed(child.nodeValue)
else:
outString += makeWellFormed(child.nodeValue.strip())