-
-
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
Backtick/grave (`) in component breaks SSR render method #616
Comments
The text visitor for SSR is already escaping things that look like embedded expressions. This might be as simple as also escaping the backquotes here. |
Yep, I'm definitely seeing that in the output, but the reason why I can't simply escape the backticks forever is because the non-SSR version of the app displays the backslashes before the backticks. |
Right, escaping the back-ticks definitely shouldn't be the user's job. I've submitted a PR to also escape ` and \ in the code for text nodes in SSR mode. I don't think there's anything else that would have to be escaped. |
I would have to agree, I can't think of anything else that would need to be escaped in a template string. Or in a regular string for that matter. |
also escape back-ticks and backslashes in text nodes in SSR code (#616)
thanks all — released 1.22.2 with the fix |
When a backtick/grave accent is used in a component, and one uses
generate: 'ssr'
, the output function breaks due to therender()
method using backticks to allow for a multi-line string.This also appears to fail with the HTML escaped representation of the grave (
`
) as svelte evaluates it back to a backtick.Smallest failing example:
Output:
I'm not sure how the generator determines to use template strings vs double-quotes, because it seems like it differs (unless I was looking at different functions at the time).
Workaround: "Escape" the backticks in the component html file.
Input:
Output:
The text was updated successfully, but these errors were encountered: