diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index c0819a233f..c7a1d8c3b1 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -189,7 +189,7 @@ export default class Selector { index !== 0 && selector.children && selector.children.length > 0 && - !/[.:#\s]/.test(selector.children[0].value) + !/[.:#\s]/.test(selector.children[0].value[0]) ) { component.error(selector, compiler_errors.css_invalid_global_selector_position); } diff --git a/test/validator/samples/css-invalid-global-placement-5/errors.json b/test/validator/samples/css-invalid-global-placement-5/errors.json new file mode 100644 index 0000000000..de4e3f79e9 --- /dev/null +++ b/test/validator/samples/css-invalid-global-placement-5/errors.json @@ -0,0 +1,12 @@ +[{ + "code": "css-invalid-global-selector-position", + "message": ":global(...) not at the start of a selector sequence should not contain type or universal selectors", + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 21 + } +}] \ No newline at end of file diff --git a/test/validator/samples/css-invalid-global-placement-5/input.svelte b/test/validator/samples/css-invalid-global-placement-5/input.svelte new file mode 100644 index 0000000000..cbd4f3a4fc --- /dev/null +++ b/test/validator/samples/css-invalid-global-placement-5/input.svelte @@ -0,0 +1,7 @@ + + +
\ No newline at end of file