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 committed by Patrick Storz
parent aa9796ea87
commit 7b9c4ee935

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]