Skip to content
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 applied to multiple selectors should be an error #5907

Closed
hjalmar opened this issue Jan 19, 2021 · 4 comments · Fixed by #6428
Closed

:global applied to multiple selectors should be an error #5907

hjalmar opened this issue Jan 19, 2021 · 4 comments · Fixed by #6428
Labels

Comments

@hjalmar
Copy link

hjalmar commented Jan 19, 2021

Describe the bug
Prefixing a css global to give it scope only scopes the first selector.

To Reproduce
https://svelte.dev/repl/aaed36026d014e34b45aedef9630b55f?version=3.31.2

Expected behavior

article.svelte-1nz7a1b div.svelte-1nz7a1b h1, article.svelte-1nz7a1b div.svelte-1nz7a1b h2, article.svelte-1nz7a1b div.svelte-1nz7a1b h3 {
    background-color: red;
}

Current behaviour

article.svelte-1nz7a1b div.svelte-1nz7a1b h1, h2, h3 {
    background-color: red;
}

Information about your Svelte project:
Latest svelte repl.

Severity
Not severe.

@Conduitry
Copy link
Member

Honestly I'm thinking that :global(h1, h2, h3) should probably be a compiler error. It's not really clear to me what it should mean. I don't think article div :global(h1, h2, h3) should be a shortcut for article div :global(h1), article div :global(h2), article div :global(h3), which is what this issue seems to be suggesting.

@hjalmar
Copy link
Author

hjalmar commented Jan 20, 2021

It would be nice in the aspect of reducing redundant code, however keeping true to the native css way it would probably be best to not introduce some custom logic. But with that said, if :global(h1, h2, h3) would still continue to be acceptable I would regard this as unexpected behavior.

@Conduitry Conduitry changed the title :global should scope all selectors not only the first :global applied to multiple selectors should be an error Feb 2, 2021
@Conduitry
Copy link
Member

In 3.38.3, this is now a compiler error.

@dsebastien
Copy link

I'm facing an issue while trying to integrate daisyUI in my Svelte application: saadeghi/daisyui#252 (comment)

I think it is related to this issue. Can anyone help me understand what the problem is and what possible fixes are? Is it a problem on Svelte's end or on daisyUI's?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants