-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Wrong server-side rendering of attributes when value is true
#6121
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I can confirm we are affected by this at @huggingface |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
unstale, and cc'ing @pngwn on this =) |
Yes feel free to open a PR |
This should be fixed now in 3.45.0. |
Describe the bug
When passing a
true
value to a custom data attribute (e.g.data-active
) in SSR, it rendersdata-active=""
.To Reproduce
Expected behavior
I'm only expecting an attribute to be rendered as
attr=""
when the value passed to it istrue
if it's a boolean attribute. In the case of any other attribute,attr="true"
should be rendered instead (as it is when using DOM rendering).Stacktraces
It's easy to see the origin of the problem, at https://github.com/sveltejs/svelte/blob/master/src/runtime/internal/ssr.ts#L130-L133
Severity
Annoying, particularly because of the inconsistency for such attributes between SSR and DOM rendering. For now we're writing things like
data-active={value === true ? 'true' : false}
as a workaround.I can open a PR to fix this behavior if it's ok for you :)
The text was updated successfully, but these errors were encountered: