inline use attribute name for lookup

This commit is contained in:
doom-goober 2021-12-04 09:20:43 -08:00
parent cebd259a78
commit 528cd1578e

View file

@ -1804,11 +1804,12 @@ def repairStyle(node, options):
if options.style_type == "inline": if options.style_type == "inline":
# Prefer inline style # Prefer inline style
# Remove known SVG attributes and store their values in style attribute # Remove known SVG attributes and store their values in style attribute
attributes = [node.attributes.item(i).nodeName for i in range(node.attributes.length)] attributes = [node.attributes.item(i) for i in range(node.attributes.length)]
for attribute in attributes: for attribute in attributes:
if attribute in svgAttributes: attributeName = attribute.nodeName
styleMap[attribute] = node.getAttribute(attribute) if attributeName in svgAttributes:
node.removeAttribute(attribute) styleMap[attributeName] = attribute.nodeValue
node.removeAttribute(attributeName)
elif options.style_type == "preserve": elif options.style_type == "preserve":
# Keep whatever style of attribute versus style the file currently has # Keep whatever style of attribute versus style the file currently has
pass pass