Simplif loop logic

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2021-01-10 11:35:06 +00:00
parent 0c50bc72ea
commit b1f056fd32
No known key found for this signature in database
GPG key ID: A65B78DBE67C7AAC

View file

@ -1381,12 +1381,11 @@ def removeUnusedAttributesOnParent(elem):
unusedAttrs[attr.nodeName] = attr.nodeValue unusedAttrs[attr.nodeName] = attr.nodeValue
# for each child, if at least one child inherits the parent's attribute, then remove # for each child, if at least one child inherits the parent's attribute, then remove
for childNum in range(len(childElements)): for child in childElements:
child = childElements[childNum]
inheritedAttrs = [] inheritedAttrs = []
for name in unusedAttrs: for name in unusedAttrs:
val = child.getAttribute(name) val = child.getAttribute(name)
if val == '' or val is None or val == 'inherit': if val == '' or val == 'inherit':
inheritedAttrs.append(name) inheritedAttrs.append(name)
for a in inheritedAttrs: for a in inheritedAttrs:
del unusedAttrs[a] del unusedAttrs[a]