Ignore set/animate elements when finding common attributes
This commit is contained in:
parent
2342830671
commit
d519dae9db
1 changed files with 11 additions and 1 deletions
12
scour.py
12
scour.py
|
|
@ -650,6 +650,9 @@ def moveCommonAttributesToParentGroup(elem):
|
||||||
|
|
||||||
commonAttrs = {}
|
commonAttrs = {}
|
||||||
# add all inheritable properties of the first child element
|
# add all inheritable properties of the first child element
|
||||||
|
# FIXME: Note there is a chance that the first child is a set/animate in which case
|
||||||
|
# its fill attribute is not what we want to look at, we should look for the first
|
||||||
|
# non-animate/set element
|
||||||
attrList = childElements[0].attributes
|
attrList = childElements[0].attributes
|
||||||
for num in range(attrList.length):
|
for num in range(attrList.length):
|
||||||
attr = attrList.item(num)
|
attr = attrList.item(num)
|
||||||
|
|
@ -671,8 +674,15 @@ def moveCommonAttributesToParentGroup(elem):
|
||||||
|
|
||||||
# for each subsequent child element
|
# for each subsequent child element
|
||||||
for childNum in range(len(childElements)):
|
for childNum in range(len(childElements)):
|
||||||
if childNum == 0: continue
|
# skip first child
|
||||||
|
if childNum == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
child = childElements[childNum]
|
child = childElements[childNum]
|
||||||
|
# if we are on an animateXXX/set element, ignore it (due to the 'fill' attribute)
|
||||||
|
if child.localName in ['set', 'animate', 'animateColor', 'animateTransform', 'animateMotion']:
|
||||||
|
continue
|
||||||
|
|
||||||
distinctAttrs = []
|
distinctAttrs = []
|
||||||
# loop through all current 'common' attributes
|
# loop through all current 'common' attributes
|
||||||
for name in commonAttrs.keys():
|
for name in commonAttrs.keys():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue