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

collapseGroups does not move attributes atomically #1928

Closed
johnkenny54 opened this issue Jan 6, 2024 · 2 comments · Fixed by #1930
Closed

collapseGroups does not move attributes atomically #1928

johnkenny54 opened this issue Jan 6, 2024 · 2 comments · Fixed by #1930
Labels

Comments

@johnkenny54
Copy link
Contributor

One thing the collapseGroups plugin does is move all attributes from a <g> element to its child if it only has a single child. It appears that the code intends this to be an "all or none" move (i.e., if any attributes can't be moved, then no attributes are moved).

As currently implemented, the code will move attributes partially and unpredictably - it moves attributes to the child sequentially until it encounters an attribute that it can't move, then it stops moving attributes. So it is possible that only some attributes are moved, and which ones are moved depends on the order of attributes, which may be changed by other plugins.

This bug is one of the reasons for regression failure of \scalable\devices\media-flash.svg.

SVGO 3.2

@johnkenny54 johnkenny54 added the bug label Jan 6, 2024
@KTibow
Copy link
Contributor

KTibow commented Jan 6, 2024

I see how this is something that should be fixed, but I don't see how this affects rendering. Can you make a MRE?

@johnkenny54
Copy link
Contributor Author

PR with test case coming shortly.

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