From aaa1797ed8633a0b26e4273055ea6cf67167aea6 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 4 Dec 2023 12:14:08 +0100 Subject: [PATCH] fix: css parser fix when inside a pseudo-class, only `)` is a valid end, and when outside, only `{` is - reflect that in the logic --- packages/svelte/src/compiler/phases/1-parse/read/style.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/svelte/src/compiler/phases/1-parse/read/style.js b/packages/svelte/src/compiler/phases/1-parse/read/style.js index 0cc56ff8ea..5197f10329 100644 --- a/packages/svelte/src/compiler/phases/1-parse/read/style.js +++ b/packages/svelte/src/compiler/phases/1-parse/read/style.js @@ -1,7 +1,6 @@ import { error } from '../../../errors.js'; const REGEX_MATCHER = /^[~^$*|]?=/; -const REGEX_CLOSING_PAREN = /(?|\|\|)\s*/; @@ -161,7 +160,7 @@ function read_selector_list(parser, inside_pseudo_class = false) { parser.allow_whitespace(); - if (parser.match('{') || (inside_pseudo_class && parser.match(')'))) { + if (inside_pseudo_class ? parser.match(')') : parser.match('{')) { return { type: 'SelectorList', start, @@ -310,7 +309,7 @@ function read_selector(parser, inside_pseudo_class = false) { const index = parser.index; parser.allow_whitespace(); - if (parser.match('{') || parser.match(',') || (inside_pseudo_class && parser.match(')'))) { + if (parser.match(',') || (inside_pseudo_class ? parser.match(')') : parser.match('{'))) { parser.index = index; return {