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

Check for filter in style as well as attribute. #1952

Merged
merged 4 commits into from Feb 7, 2024

Conversation

johnkenny54
Copy link
Contributor

collapseGroups was not detecting a filter when it was in a style rather than an attribute.

This change resolves one regression mismatch (svgs/oxygen-icons-5.113.0/scalable/mimetypes/small/64x64/image-x-adobe-dng.svg) and reduces pixel mismatches by 67.

This type of problem seems like it is probably widespread (including in the same conditional in this plugin, where it is looking for a clip-path). I didn't see any tools to query the style attribute in a standard way. The solution in this PR is not going to scale well - it seems like it would be desirable to have a standardized, efficient way to query/change the style attribute - maybe it's there and I'm missing it?

@KTibow
Copy link
Contributor

KTibow commented Feb 4, 2024

Why do this instead of getComputedStyle?

@johnkenny54 johnkenny54 marked this pull request as ready for review February 4, 2024 16:37
@johnkenny54
Copy link
Contributor Author

Why do this instead of getComputedStyle?

Are you talking about computeStyle()? This seems like it has a huge overhead.

@SethFalco
Copy link
Member

Are you talking about computeStyle()? This seems like it has a huge overhead.

I'd recommend using computeStyle too. It will also account for the stylesheet.

@johnkenny54
Copy link
Contributor Author

I changed to computeStyle(). Regression results were identical.

I created issue #1953 to begin discussions on the more general issue that style handling is inconsistent, inefficient, and incorrect.

plugins/collapseGroups.js Outdated Show resolved Hide resolved
Co-authored-by: Seth Falco <seth@falco.fun>
Copy link
Member

@SethFalco SethFalco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a minor comment, but looks good overall!

Edit: Strange… GitHub isn't showing the comment… I'll write it again, I guess. ^-^'

plugins/collapseGroups.js Outdated Show resolved Hide resolved
Co-authored-by: Seth Falco <seth@falco.fun>
@SethFalco SethFalco merged commit a938d5e into svg:main Feb 7, 2024
8 checks passed
@johnkenny54 johnkenny54 deleted the collapseGroups branch February 16, 2024 02:59
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

4 participants