Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeUselessDefs removes <symbol> which contains children with IDs #1922

Closed
johnkenny54 opened this issue Jan 3, 2024 · 0 comments · Fixed by #1923
Closed

removeUselessDefs removes <symbol> which contains children with IDs #1922

johnkenny54 opened this issue Jan 3, 2024 · 0 comments · Fixed by #1923
Labels

Comments

@johnkenny54
Copy link
Contributor

If the <symbol> itself does not have an ID, removeUselessDefs removes <symbol> elements which contains children with IDs.

To Reproduce
Optimize the following with removeUselessDefs enabled:

<svg xmlns="http://www.w3.org/2000/svg">
    <rect fill="url(#a)" width="64" height="64"/>
    <symbol>
        <linearGradient id="a">
            <stop offset="5%" stop-color="gold" />
        </linearGradient>
    </symbol>
</svg>

Expected behavior
File is unchanged because linearGradient is referenced.

Additional context
This bug is part of the cause of test-regression failures on media-flash.svg.

  • SVGO Version 3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant