-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Dynamic class breaks CSS selector #3544
Comments
The problem here is that, the container div doesn't get the svelte-generated class name. The child's class can be any variable declared in a script tag too, and an {#if} tag also causes the same problem, so I guess it can be reproduced with any svelte-tag.
results in |
Not a fix, but a "simple" workaround is to add an empty Thankfully, the blank selector should be easily removed by a minifier while still maintaining the generated class. |
As you can see I've added a test for the issue in my fork. I'm very interested in trying to fix this issue, if it's okay with everyone? I can identify a contradiction in the current code (
I plan to do some refactoring of |
…rs might match selector. Fixes sveltejs#3544
Describe the bug
Some style rules aren't being applied when there is a dynamic class between the root node and target node of the selector.
Logs
N/A
To Reproduce
https://svelte.dev/repl/c122185d662a4897a4cda657d07a3027?version=3.12.0
Expected behavior
I would expect all three lines of the REPL to have red text. Only the second and third do.
Stacktraces
N/A
Information about your Svelte project:
Firefox 69.0
Arch Linux
Svelte 3.12.0
Severity
It's annoying and very unexpected, but I can work around it.
Additional context
N/A
The text was updated successfully, but these errors were encountered: