Sort declarations in style attribute (#107)

This commit is contained in:
Dirk Thomas 2016-08-31 13:29:01 -07:00 committed by Eduard Braun
parent 3929426a5a
commit dc3f66ed0f

View file

@ -3000,6 +3000,9 @@ def serializeXML(element, options, ind = 0, preserveWhitespace = False):
quot = "'"
attrValue = makeWellFormed( attr.nodeValue )
if attr.nodeName == 'style':
# sort declarations
attrValue = '; '.join([p for p in sorted(attrValue.split(';'))])
outParts.append(' ')
# preserve xmlns: if it is a namespace prefix declaration