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

Invalid output is produced for specific file, <out> element with non-existing id in xlink:href is created #1765

Open
VaclavC opened this issue Apr 26, 2023 · 1 comment · May be fixed by #2051
Labels

Comments

@VaclavC
Copy link

VaclavC commented Apr 26, 2023

Describe the bug
If I process attached file with svgo, I get invalid svg. There is an element with xlink:href attribute pointing to an element with id 'cF', which is not present in file. Inkscape and eog are fine with that, but Apache Batik is unable to process resulting svg then.

To Reproduce
Steps to reproduce the behavior:

  1. Convert provided file 'svg1.svg' with svgo
  2. Check the output

Expected behavior
A valid svg as output.

Screenshots
No applicable

Desktop (please complete the following information):

  • SVGO Version 2.8.0 or 3.0.2, both produce invalid output

Additional information
File svg2.svg is mentioned invalid output

svg1
svg2

@VaclavC VaclavC added the bug label Apr 26, 2023
@SethFalco
Copy link
Member

This issue still occurs with SVGO v3.1.0.

The removeEmptyContainers plugin drops empty symbols because they're useless, but doesn't remove references to the useless symbol.

MRE

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 630 368">
  <symbol id="z"/>
  <use href="#z" x="150" y="349"/>
</svg>
module.exports = {
  js2svg: {
    pretty: true,
    indent: 2,
  },
  plugins: [
    "removeEmptyContainers",
  ]
}

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.

2 participants