-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Preserve camelCase for known svg elements #3875
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
base: master
Are you sure you want to change the base?
Conversation
SVG elements like feDropShadow were incorrectly converted to lowercase, breaking their functionality. Now properly preserves casing for known SVG elements while normalizing regular HTML elements. Fixes svg filter rendering issue where filters would not display.
Visit the preview URL for this PR (updated for commit ce06bb1): https://yew-rs-api--pr3875-fix-svg-filter-casin-4g31o9zo.web.app (expires Wed, 23 Jul 2025 04:13:33 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
@WorldSEnder what's your stance on this? I see you worked on #2578 which is related to this issue |
Related: #3871 Current yew actually panics during hydration while handling these dynamic camelCase svg elements, It's currently impossible to use these svg elements in a SSR app: lowercase doesn't work, camelCase panics at hydration. |
Why does Yew even meddle with the element names? shouldn't it pass them to the browser as they're specified? |
Description
This PR fixes SVG filter elements that require camelCase names (like
feDropShadow
) from being incorrectly lowercased, which causes them to not function at all in browsers.The Problem
SVG filter effects completely stop working when their element names are lowercased:
The browser does not recognize
<fedropshadow>
as a valid SVG filter primitive, so the entire filter effect is ignored.The Fix
This PR modifies the tag name handling to:
is_normalised_element_name
function)This ensures SVG elements work correctly while maintaining the expected behavior for HTML elements.
Testing
Tested with a minimal reproduction:
feDropShadow
,feGaussianBlur
, etc. do not renderExample