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

case-sensitivity of SVG viewBox likely to cause silent errors #1062

Closed
lnryan opened this issue Dec 31, 2017 · 3 comments · Fixed by #1095
Closed

case-sensitivity of SVG viewBox likely to cause silent errors #1062

lnryan opened this issue Dec 31, 2017 · 3 comments · Fixed by #1095
Labels

Comments

@lnryan
Copy link

lnryan commented Dec 31, 2017

In most 'try online' tools, the SVG viewBox attribute is handled the same whether properly camel-cased or not (viewbox). Svelte only recognizes viewBox. This can make it difficult for developers new to SVG - especially when they are starting with random sample code from blogs/tutorials - as improper use simply doesn't show up. Either an compile-time warning or acceptance of both variants would be helpful.

Example:
When I try to render <svg viewbox="-250 -250 500 500"> with the Svelte, my image is cutoff. Whereas on W3Schools or CodePen, it renders fine, indicating that width and height aren't inherently mandatory. I had the same results testing locally and with REPL.

When I try <svg width=500 height=500 viewbox="-250 -250 500 500"> it will adjust the size correctly, but doesn't respect the viewbox.

Since I started with pasting a blog example, I mistakenly thought svelte couldn't handle viewbox.

@Conduitry
Copy link
Member

I take it from what's been said on the closed PR #1077 that what we'd want to do is lowercase all of the attribute names in HTML, and to lowercase SVG ones, apart from those with mixed case here and to instead make those conform to the case in that list?

@Rich-Harris
Copy link
Member

Yep, exactly — have raised #1095 to that end

Rich-Harris added a commit that referenced this issue Jan 11, 2018
be more relaxed about attribute casing
@Rich-Harris
Copy link
Member

This is fixed in 1.52, thanks

Rich-Harris added a commit that referenced this issue Jan 26, 2018
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.

4 participants