remapNamespacePrefix: Preserve prefix of attribute names
Preserve prefix of attribute names when copying them over to the new node. This fixes an unintentional rewrite of `xml:space` to `space` that also caused scour to strip whitespace that should have been preserved. Closes: #239 Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
985cb58a26
commit
96d85ee819
3 changed files with 12 additions and 2 deletions
|
|
@ -1502,7 +1502,16 @@ class RemoveRedundantSvgNamespacePrefix(unittest.TestCase):
|
|||
doc = scourXmlFile('unittests/redundant-svg-namespace.svg').documentElement
|
||||
r = doc.getElementsByTagNameNS(SVGNS, 'rect')[1]
|
||||
self.assertEqual(r.tagName, 'rect',
|
||||
'Redundant svg: prefix not removed')
|
||||
'Redundant svg: prefix not removed from rect')
|
||||
t = doc.getElementsByTagNameNS(SVGNS, 'text')[0]
|
||||
self.assertEqual(t.tagName, 'text',
|
||||
'Redundant svg: prefix not removed from text')
|
||||
|
||||
# Regression test for #239
|
||||
self.assertEqual(t.getAttribute('xml:space'), 'preserve',
|
||||
'Required xml: prefix removed in error')
|
||||
self.assertEqual(t.getAttribute("space"), '',
|
||||
'Required xml: prefix removed in error')
|
||||
|
||||
|
||||
class RemoveDefaultGradX1Value(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue