inline use attribute name for lookup
This commit is contained in:
parent
cebd259a78
commit
528cd1578e
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue