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

SVG viewBox attribute is incorrectly applied #177

Closed
marklundin opened this issue Jun 5, 2016 · 4 comments
Closed

SVG viewBox attribute is incorrectly applied #177

marklundin opened this issue Jun 5, 2016 · 4 comments

Comments

@marklundin
Copy link

When a component renders different svg elements depending on it's state, it will incorrectly apply the viewBox attribute from the first svg element rendered to the second.

Test case : https://jsfiddle.net/jdqhus9m/

  1. First SVG is displayed with viewBox="50 0 50 50" attribute displaying a green rect.
  2. Click on the SVG element to trigger a state change, rendering a different svg without the viewbox attribute. Notice in the dom, that the new svg contains the viewBox="50 0 50 50" attribute from the first render.

Expected result: SVG element should have no viewBox attribute and should display the red and greenbox side by side.

@developit
Copy link
Member

Thanks for the detailed bug report! I'm thinking it's failing to set the property but the error is being caught and suppressed. I can't check now, but maybe it's fixed in https://npmcdn.com/preact@beta ?

@marklundin
Copy link
Author

marklundin commented Jun 5, 2016

Awesome. Will check in the morning and let you know

@developit
Copy link
Member

@marklundin This ended up being a bug in preact-svg. It's now fixed, released as [email protected]. Thanks again :)

@marklundin
Copy link
Author

Great work @developit !

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

2 participants