-
-
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
feat: class
directive on <svelte:body>
#6928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gg
As I mentioned on #3105, I'm worried about doing this without it also working in SSR, and we would need to agree on an API for that. It should probably look like stringified attributes - rather than just a list of class names - so that it can be expanded to other features later. That these classes would not be scoped makes more sense than them being scoped, I think, but needing |
Is there any movement on this request? issue #3105 was created 3 years ago |
I would also be interested in using this with SSR |
Since this is only adding class to the body element, I don't think SSR support is really necessary. The script can add the class once it's loaded. |
In my specific case it was a static page that didn't hydrate, which is something sveltekit supports and is a not too uncommon use-case. In this case it wouldn't work an still be handy. |
class
directive on <svelte:body>
@andirady is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
Can someone please authorize this? |
Closing Svelte 4 PRs as stale — thank you (in the case of this issue, it really is something that should happen programmatically, so that developers are forced to deal with a) the lack of SSR support and b) the possibility of conflicts between components) |
Closes #3105
Supports
class
directive on<svelte:body>
. The following works:Note that the class is global. Without
:global
the compiler will produce a warning.P/S: Codes are copied from
src\compiler\compile\render_dom\wrappers\Element\index.ts
😋Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint