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

Cannot read property 'hasStyle' from undefined #50

Closed
Kwerag opened this issue Feb 4, 2020 · 2 comments
Closed

Cannot read property 'hasStyle' from undefined #50

Kwerag opened this issue Feb 4, 2020 · 2 comments

Comments

@Kwerag
Copy link

Kwerag commented Feb 4, 2020

I have multiple images with inline style="..." elements e.g.

<clipPath id="...">
		<use xlink:href="..." style="overflow:visible;"/>
</clipPath>

When running s2v I get
Error Cannot read property 'hasStyle' of undefined while converting file /.../mysvg.svg

When I remove the style="overflow:visible; it works (but the image looks not as the original of course)

Do you know why that error occurs?

@alpox
Copy link

alpox commented Feb 4, 2020

A short trackdown revealed that the origin of the error is likely located here:
https://github.com/svg/svgo/blob/master/lib/svgo/jsAPI.js#L291

When trying to add the style attribute.

The value this.style in the dependency does not seem to be set - it may have to be initialized by adding a CSSStyleDeclaration to the JSAPI constructor.

@Kwerag
Copy link
Author

Kwerag commented Feb 4, 2020

And I found a second issue:
Could it be, that clip-path in the <style> block is not supported?

.st1{clip-path:url(#SVGID_2_);}

EDIT: created a separate issues for that:
#51

@Ashung Ashung closed this as completed Dec 13, 2021
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

No branches or pull requests

3 participants