Fix Bug 405744: Keep namespace declarations when --keep-editor-data. Add tests.
This commit is contained in:
parent
4ee372f561
commit
8f50f0d509
3 changed files with 44 additions and 13 deletions
22
scour.py
22
scour.py
|
|
@ -1517,17 +1517,17 @@ def scourString(in_string, options=None):
|
|||
pass
|
||||
while removeNamespacedAttributes( doc.documentElement, unwanted_ns ) > 0 :
|
||||
pass
|
||||
|
||||
# remove the xmlns: declarations now
|
||||
xmlnsDeclsToRemove = []
|
||||
attrList = doc.documentElement.attributes
|
||||
for num in range(attrList.length) :
|
||||
if attrList.item(num).nodeValue in unwanted_ns :
|
||||
xmlnsDeclsToRemove.append(attrList.item(num).nodeName)
|
||||
|
||||
for attr in xmlnsDeclsToRemove :
|
||||
doc.documentElement.removeAttribute(attr)
|
||||
numAttrsRemoved += 1
|
||||
|
||||
# remove the xmlns: declarations now
|
||||
xmlnsDeclsToRemove = []
|
||||
attrList = doc.documentElement.attributes
|
||||
for num in range(attrList.length) :
|
||||
if attrList.item(num).nodeValue in unwanted_ns :
|
||||
xmlnsDeclsToRemove.append(attrList.item(num).nodeName)
|
||||
|
||||
for attr in xmlnsDeclsToRemove :
|
||||
doc.documentElement.removeAttribute(attr)
|
||||
numAttrsRemoved += 1
|
||||
|
||||
# repair style (remove unnecessary style properties and change them into XML attributes)
|
||||
numStylePropsFixed = repairStyle(doc.documentElement, options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue