-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Style directive inconsistent for client-side rendering and server-side rendering #11044
Comments
the root cause of this problem is svelte/packages/svelte/src/internal/server/index.js Lines 380 to 385 in f7c8fd5
which return empty string when |
dummdidumm
added a commit
that referenced
this issue
May 13, 2024
dummdidumm
added a commit
that referenced
this issue
May 13, 2024
This was referenced May 13, 2024
trueadm
pushed a commit
that referenced
this issue
May 13, 2024
dummdidumm
added a commit
that referenced
this issue
May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I have the following code in a
+page.svelte
file:Then I use
npm run dev
, and when client-side JS is enabled in my web browser, the inspected HTML code looks like this (as I expect):But if I disable client-side JS in my web browser, the inspected HTML code looks like this (not as I expect;
style="--number: 0;"
is missing from the first<li>
):Using
npm run build
(usingadapter-static
) on my real project also generates the HTML code with the missingstyle
attribute for the0
value, so I'm guessing server-side rendering for some reason removes it because0
is falsy.Reproduction
git clone https://github.com/PeppeL-G/svelte-bug-style.git
cd svelte-bug-style
(the code is in thesrc/routes/+page.svelte
-page)npm install
npn run dev
Logs
No response
System Info
Severity
annoyance
Additional Information
A workaround that works for me is to use a CSS rule that assigns all involved elements
0
as the default value:The text was updated successfully, but these errors were encountered: