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

Fix prefixIds plugin to properly handle url()s in style="..." #1592

Merged
merged 4 commits into from Sep 30, 2021

Conversation

IlyaSkriblovsky
Copy link
Contributor

First of all, thanks for the great tool!

prefixIds plugin currently breaks url()-links inside style attributes:

optimize(
  `<g style="fill:url(#brush-id);stroke:url(#pen-id)"/>`,
  { plugins: ['prefixIds'] }
).data

will generate <g style=""/>. Seems like prefixIds assumes that attribute's whole value might be url(), but this is not the case for the style attribute.

This fix solves the issue by preserving all attribute's content other than #id inside url(). It also adds some more tests for the prefixIds plugin.

plugins/prefixIds.js Outdated Show resolved Hide resolved
@TrySound TrySound merged commit 6235264 into svg:master Sep 30, 2021
@TrySound
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants