mirror of https://github.com/sveltejs/svelte
fix: prevent invalid `:global` usage (#12474)
* fix: prevent invalid `:global` usage Error when it's not at the end of a selector closes #12437 * fix validation * fix * fix types --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12478/head
parent
bc9907aa1c
commit
04da87b599
@ -0,0 +1,10 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
error: {
|
||||||
|
code: 'css_global_block_invalid_placement',
|
||||||
|
message:
|
||||||
|
'A :global {...} block can only appear at the end of a selector sequence (did you mean to use :global(...) instead?)',
|
||||||
|
position: [50, 57]
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,8 @@
|
|||||||
|
<style>
|
||||||
|
/* ok */
|
||||||
|
.x :global {
|
||||||
|
}
|
||||||
|
/* not ok */
|
||||||
|
:global .x {
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue