-
-
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
:global(...) .child selector is given svelte- suffix if there is a variable class name in the html #4314
Comments
I do think there's a bug here, but I don't think it's what you're saying it is.
What does seem to be a bug to me is that, starting from your example, if you remove the |
I think Consider the flattened form: Child being a svelte component shouldn't change that. I think the right way to go about this though would be If I understand correctly though, anything not |
Thanks for clarifying @Conduitry. I was under the impression that |
Fixed in 3.18.1 - https://svelte.dev/repl/0cf466aa625c42ed9dc845d0b46d1905?version=3.18.1 - in that the text is now not purple regardless of the presence of |
If there is an element with a
class={someVariable}
attribute in the markup,:global(body) .className
child selectors get suffixed, and therefore don't apply to child components.For example, if you have a parent component that applies a "theme" class to its top-level element, and has child selectors to style matching elements within all its child components depending on the theme, it doesn't work if the theme class is a variable (but does if it's hard-coded as e.g.
<div class="purple">
.(The variable class is what's relevant - any element with a non-hard-coded class name in the parent component will break it.)
REPL:
The text was updated successfully, but these errors were encountered: