(Partial?) fix for bug 594930: In a <switch>, require one level of <g> if there was a <g> in the file already. Otherwise, only the first subelement of the <g> is chosen and rendered.
This commit is contained in:
parent
26d90a7529
commit
bb1a38a7ad
1 changed files with 12 additions and 9 deletions
5
scour.py
5
scour.py
|
|
@ -749,9 +749,12 @@ def removeNestedGroups(node):
|
||||||
num = 0
|
num = 0
|
||||||
|
|
||||||
groupsToRemove = []
|
groupsToRemove = []
|
||||||
|
# Only consider <g> elements for promotion if this element isn't a <switch>.
|
||||||
|
# (partial fix for bug 594930, required by the SVG spec however)
|
||||||
|
if not (node.nodeType == 1 and node.nodeName == 'switch'):
|
||||||
for child in node.childNodes:
|
for child in node.childNodes:
|
||||||
if child.nodeName == 'g' and child.namespaceURI == NS['SVG'] and len(child.attributes) == 0:
|
if child.nodeName == 'g' and child.namespaceURI == NS['SVG'] and len(child.attributes) == 0:
|
||||||
# only collapse group if it does not have a title or desc as a direct descendant
|
# only collapse group if it does not have a title or desc as a direct descendant,
|
||||||
for grandchild in child.childNodes:
|
for grandchild in child.childNodes:
|
||||||
if grandchild.nodeType == 1 and grandchild.namespaceURI == NS['SVG'] and \
|
if grandchild.nodeType == 1 and grandchild.namespaceURI == NS['SVG'] and \
|
||||||
grandchild.nodeName in ['title','desc']:
|
grandchild.nodeName in ['title','desc']:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue