-
-
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
Duplicated generated Svelte class .foo.svelte-r4nd0m.svelte-r4nd0m in CSS selector #9009
Comments
Duplicate of #4374. You can find an explanation of why this occurs in this comment: #4374 (comment) |
Wait, not so fast. In the mentioned example "#1277" I can see that the selector to To the argument in the linked issue:
How can the selector |
Sure, but it's the same root issue as #4374.
That part of the explanation is about why Svelte adds scoping classes to the first and last selector in a style rule. If you have a rule I explained this in more detail in a blog post a couple years back, if that helps you understand what's going on: https://geoffrich.net/posts/svelte-scoped-styles/#heading-specificity-and-scoping But either way, discussion of what Svelte should do differently in this case should happen in #4374 to keep the conversation centralized. |
Describe the bug
Svelte generates internal CSS classes and adds them to nodes and CSS selectors, as far as I can tell, for namespacing.
In some constellations, Svelte generates CSS selectors with the internal CSS selector added twice, i.e. for an element with class
.foo
Svelte compiles the CSS rule.foo.svelte-r4nd0m.svelte-r4nd0m
..state .foo
selector changes the outcome)See the marked selector:
Reproduction
https://svelte.dev/repl/01fd443e12b44915a8cb871fcf067257?version=4.0.5
The
.bar
element gets the.svelte-r4nd0m
class twice.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: