-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling
Description
Describe the bug
When using class="{undefined}"
on any HTML element, it becomes entirely unstylable. Neither Element-based selectors (p {}
) nor child selectors (div > p {}
) apply any styling.
Adding ANYTHING else (even just a single space!) in the quotes resolves this problem. class="undefined"
does not trigger this bug. Neither does class="{null}"
. This seems to be a very specific edge case.
Reproduction
Minimal Reproducer: https://svelte.dev/playground/b2d6494d6d55496baf592d6f31835807?version=5.25.3
Context: NodeDrawer.svelte#L45
Since not all usages of the NodeDrawer
override the innerClass
, it is undefined
in some instances, therefore triggering this issue. Changing the default to null
resolves the problem.
System Info
System:
OS: Linux 6.13 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory: 7.32 GB / 31.21 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.9.0 - /sbin/node
Yarn: 1.22.22 - /sbin/yarn
npm: 11.2.0 - /sbin/npm
pnpm: 10.6.2 - /sbin/pnpm
Browsers:
Firefox: 136.0.1
npmPackages:
svelte: ~5.20.4 => 5.20.5
Severity
annoyance
Metadata
Metadata
Assignees
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling