mirror of https://github.com/sveltejs/svelte
fix: allow `:global(..)` in compound selectors (#10266)
Someone could programmatically add a class to an element and Svelte doesn't see it, so having global be part of a modifier is necessary so that Svelte doesn't mark it as unused fixes #10210pull/10267/head
parent
6b0bd8b23a
commit
036e88f1f7
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: allow `:global(..)` in compound selectors
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
warnings: []
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
div.svelte-xyz.blue {
|
||||
color: blue;
|
||||
}
|
||||
span.blue.x.svelte-xyz {
|
||||
color: blue;
|
||||
}
|
||||
span.x.svelte-xyz.bg {
|
||||
background: red;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<div class="svelte-xyz">someone could programmatically add a class to this, so having global be part of a modifier is necessary</div>
|
||||
<span class="x svelte-xyz">-</span>
|
@ -0,0 +1,14 @@
|
||||
<div>someone could programmatically add a class to this, so having global be part of a modifier is necessary</div>
|
||||
<span class="x">-</span>
|
||||
|
||||
<style>
|
||||
div:global(.blue) {
|
||||
color: blue;
|
||||
}
|
||||
span:global(.blue).x {
|
||||
color: blue;
|
||||
}
|
||||
span.x:global(.bg) {
|
||||
background: red;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue