yewstack / yew

Rust / Wasm framework for creating reliable and efficient web applications
https://yew.rs
Apache License 2.0
30.61k stars 1.42k forks source link

SVG issue with lineargradient. #3667

Closed toastxc closed 1 month ago

toastxc commented 4 months ago

Problem

Steps To Reproduce Steps to reproduce the behavior:

git clone https://github.com/toastxc/yew-svg
cd yew-svg/
trunk serve

Expected behavior An SVG rectangle should appear on the screen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

Questionnaire

toastxc commented 4 months ago

This SVG issue is strange, as the exact same code works fine in a normal HTML file. My apologizes if this is a duplicate issue.

toastxc commented 4 months ago

Ok I found a solution by digging around issues, <@{"linearGradient"} to be precise. Y'all should really document or fix this problem...

vpochapuis commented 1 month ago

Ok I found a solution by digging around issues, <@{"linearGradient"} to be precise. Y'all should really document or fix this problem...

Hey~ I stumbled on the same issue recently, and as mentioned its related to https://github.com/yewstack/yew/issues/2483

It seems that it has been documented in the macro introduction: https://github.com/yewstack/yew/pull/2703

You can see it here in the official documentation at the 4. https://yew.rs/docs/concepts/html: image

WorldSEnder commented 1 month ago

Yes thank you for mentioning it again vpochapuis. For any surprised readers, to the best of my knowledge the original intention was to use rust snaking for these kind of names instead of camel case (so my_tag instead of myTag) so that we could more easily add modules for different kinds of well known tags. The exact details are a bit shrouded in history.

I would think a PR that only applies this "casing fix" to well known tags, i.e. things that we know should be lowercased and leaves unknown tags alone would be welcome as long as it has a bit of explanation how it doesn't break existing code and adjusts the nightly lint.