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

Transfer svg presentation attributes to a wrapping g element #110

Merged
merged 2 commits into from
Nov 21, 2021

Conversation

tomasklaen
Copy link
Contributor

#107 became too annoying to deal with manually, so here's a PR.

If a style or any other presentation attributes are detected on a main <svg> element, the content of a symbol will be wrapped in <g> and those attributes transferred to it.

List of presentation attributes taken from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation

index.js Show resolved Hide resolved
@w0rm
Copy link
Owner

w0rm commented Nov 21, 2021

Sorry for spamming you with notifications. I was thinking to use Set instead of Array for presentationAttributes, but in the end I came up with an idea to loop through presentationAttributes and deleted my other comments.

And thanks again for taking time to implement this feature.

@w0rm w0rm merged commit 3edf62a into w0rm:main Nov 21, 2021
@w0rm
Copy link
Owner

w0rm commented Nov 21, 2021

@tomasklaen thanks, will release shortly. I will make it a major version bump because folks could be relying on the implicit attribute cleanup.

@tomasklaen
Copy link
Contributor Author

tomasklaen commented Nov 21, 2021

Yeah that's wise. The new behavior will definitely cause some icons to now have hardcoded colors, since previously all fill attributes on svg were being dropped.

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.

2 participants