Fix improper comparison of numeric default attribute values with text values resulting in wrongly removed attributes
For example for `orient="auto"` SVGLength() returns (value=0, units=Unit.INVALID); since the default value for `orient` is zero it was removed as there was check for a valid unit.
This commit is contained in:
parent
3511c05298
commit
2e84d57efa
1 changed files with 1 additions and 1 deletions
|
|
@ -1750,7 +1750,7 @@ def removeDefaultAttributeValue(node, attribute):
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
nodeValue = SVGLength(node.getAttribute(attribute.name))
|
nodeValue = SVGLength(node.getAttribute(attribute.name))
|
||||||
if (attribute.value is None) or (nodeValue.value == attribute.value):
|
if (attribute.value is None) or ((nodeValue.value == attribute.value) and not (nodeValue.units == Unit.INVALID)):
|
||||||
if (attribute.units is None) or (nodeValue.units == attribute.units) or (isinstance(attribute.units, list) and nodeValue.units in attribute.units):
|
if (attribute.units is None) or (nodeValue.units == attribute.units) or (isinstance(attribute.units, list) and nodeValue.units in attribute.units):
|
||||||
if (attribute.conditions is None) or attribute.conditions(node):
|
if (attribute.conditions is None) or attribute.conditions(node):
|
||||||
node.removeAttribute(attribute.name)
|
node.removeAttribute(attribute.name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue