diff --git a/plugins/removeEmptyContainers.js b/plugins/removeEmptyContainers.js index d803fc9c9..bff3ab9c9 100644 --- a/plugins/removeEmptyContainers.js +++ b/plugins/removeEmptyContainers.js @@ -49,6 +49,9 @@ exports.fn = () => { if (node.name === 'mask' && node.attributes.id != null) { return; } + if (parentNode.type === 'element' && parentNode.name === 'switch') { + return; + } detachNodeFromParent(node, parentNode); }, }, diff --git a/test/plugins/removeEmptyContainers.06.svg b/test/plugins/removeEmptyContainers.06.svg new file mode 100644 index 000000000..3874d1eed --- /dev/null +++ b/test/plugins/removeEmptyContainers.06.svg @@ -0,0 +1,25 @@ +In switch elements, don't remove non-rendering children that contain +conditional attributes like requiredFeatures, requiredExtensions, or +systemLanguage. + +=== + + + + + + Viewer does not support full SVG 1.1 + + + + +@@@ + + + + + + Viewer does not support full SVG 1.1 + + +