mirror of https://github.com/sveltejs/svelte
fix: allow `&` to appear at the top when inside a `:global(...)` (#13215)
It's a valid CSS rule, which means "select the scope root": https://developer.mozilla.org/en-US/docs/Web/CSS/Nesting_selector#using_outside_nested_rulepull/13231/head
parent
61d51958d7
commit
1a9d8a509c
@ -0,0 +1,10 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
error: {
|
||||||
|
code: 'css_nesting_selector_invalid_placement',
|
||||||
|
message:
|
||||||
|
'Nesting selectors can only be used inside a rule or as the first selector inside a lone `:global(...)`',
|
||||||
|
position: [151, 152]
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,16 @@
|
|||||||
|
<style>
|
||||||
|
/* valid */
|
||||||
|
:global(&) {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
:global(& div) {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
:global(&) div {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
/* error */
|
||||||
|
:global(div &) {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue