You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug
In SSR mode, <a target={true ? undefined : "..."} {...$$props}> renders <a target="undefined"> instead of <a>. This does not appear to happen when {...$$props} is not present.
Expected behavior
The expected behavior is that undefined attributes should be omitted. These are PRs that I found are similar in scope:
This is a very huge bug. I came across the same problem. On server side I get <img src="some.jpg" srcset="undefined"> instead <img src="some.jpg"> and it breaks an image because srcset takes precedence over src. Therefore, users with javascript disabled and Google won`t see images. Are there any insurmountable obstacles to fix this bug?
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.
Bug
In SSR mode,
<a target={true ? undefined : "..."} {...$$props}>
renders<a target="undefined">
instead of<a>
. This does not appear to happen when{...$$props}
is not present.Expected behavior
The expected behavior is that
undefined
attributes should be omitted. These are PRs that I found are similar in scope:#1668
#4498
#1815
Repro
I created a repro to demonstrate my use case: https://github.com/zaydek/svelte-undefined-bug. Simply run
yarn test
ornpm run test
to see the same result as in the screenshot.Furthermore, in this repl: https://svelte.dev/repl/aaedb6456d714a9f9ccfab9c84c8b391?version=3.32.1, when SSR mode is enabled, you can see that it generates:
I suspect escape is the culprit; it should be omitting the value instead of escaping it as a string literal.
The text was updated successfully, but these errors were encountered: