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

convertStyleToAttrs breaks IE11 in a case if CSS variables are used for colors #995

Closed
FlyingDR opened this issue Jul 7, 2018 · 2 comments

Comments

@FlyingDR
Copy link

FlyingDR commented Jul 7, 2018

As of v1.0.5 convertStyleToAttrs produces output that conflicts with IE11 in a case if CSS variables are used for colors. Example of such SVG is export of icomoon.io.

Here is test IcoMoon project, it can be loaded here. It consists of single facebook.svg icon. You can export SVG icons for the project by using Generate SVG & More below and then Download. Result of this export is symbol-defs.svg. As you can see - it basically consists of

<path fill="#3a589b" style="fill: var(--color1, #3a589b)" d=..."></path>

Attempt to optimize this project using svgo with this command line:

svgo --disable removeUselessDefs --disable cleanupIDs --enable removeTitle symbol-defs.svg

results into following <path>:

<path fill="var(--color1,#3a589b)" d=""/>

As you can see - result for fill attribute now contains CSS variable that is not supported in IE11. As a result - icon looks like plain black square in IE11.

Of course it is possible to just disable convertStyleToAttrs plugin in this case but maybe it worth to handle such situation by e.g. adding plugin that will strip CSS variables or detect CSS variable and not replace attribute in this case.

@TrySound
Copy link
Member

convertStyleToAttrs will be disabled by default in the next release
#1365

@TrySound
Copy link
Member

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

No branches or pull requests

2 participants