-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SVG gradient doesn't work #377
Comments
I also just hit this problem. Executing A workaround that doesn't involve calling js functions is to move the defs into a separate, zero-size svg, which you can add to the html directly. However this only works if your defs are static. Any idea how to debug this further? |
I recommend to try some experiments / hacks / workarounds in set_default_element_state and patch_el_details.
It's hard-to-debug bug and I would be very glad if you manage to write at least an ugly hack to fix it. Good luck and don't hesitate to write me on chat or here so we can resolve it faster. |
Previously XML elements which use some upper case letters would be converted to all-lowercase during string parsing. As xml is case-sensitive, this breaks the element. An example is the XML linearGradient. This was caused by the code incorrectly converting all element names to lowercase to ensure HTML tags are correctly assigned, as they use lower case internally, but the browser function tagName returns all caps for HTML tags. Fix this by only converting HTML element names to lower case. Fix: seed-rs#377
Ok, I found the problem. Fortunately it is completely unrelated to url resolving. 😅 (was already going down that rabbit hole before creating commenting the first time on this issue) My first observation was that a svg with a linearGradient works correctly when I construct it using the seed macros, only using raw! doesn't work. After some diffing I found the problem: SVG is pure XML and so element names are case sensitive, while HTML elements don't care. So the Proposed fix in #447. |
Previously XML elements which use some upper case letters would be converted to all-lowercase during string parsing. As xml is case-sensitive, this breaks the element. An example is the XML linearGradient. This was caused by the code incorrectly converting all element names to lowercase to ensure HTML tags are correctly assigned, as they use lower case internally, but the browser function tagName returns all caps for HTML tags. Fix this by only converting HTML element names to lower case. Fix: seed-rs#377
It should render letter D with gradient on a blue circle. Only cirle is rendered. It works when
fill
inpath
is set to e.g.black
(fill="black"
).So it looks there is a problem with
url
infill="url(#paint0_linear)"
. There were many bugs and strange behavior in gradient handling by browsers (Chrome, Firefox and others) so it's possible it isn't a bug in Seed, but maybe Seed somehow affects url resolving or rendering.Note - SVG has been generated by Figma.
The text was updated successfully, but these errors were encountered: