fix: allow comments after last selector in css

pull/11723/head
paoloricciuti 2 years ago
parent 0128df33da
commit 324aa6492b

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: allow comments after last selector in css

@ -139,6 +139,8 @@ function read_selector_list(parser, inside_pseudo_class = false) {
const end = parser.index; const end = parser.index;
allow_comment_or_whitespace(parser);
parser.allow_whitespace(); parser.allow_whitespace();
if (inside_pseudo_class ? parser.match(')') : parser.match('{')) { if (inside_pseudo_class ? parser.match(')') : parser.match('{')) {
@ -324,7 +326,7 @@ function read_selector(parser, inside_pseudo_class = false) {
} }
const index = parser.index; const index = parser.index;
parser.allow_whitespace(); allow_comment_or_whitespace(parser);
if (parser.match(',') || (inside_pseudo_class ? parser.match(')') : parser.match('{'))) { if (parser.match(',') || (inside_pseudo_class ? parser.match(')') : parser.match('{'))) {
// rewind, so we know whether to continue building the selector list // rewind, so we know whether to continue building the selector list

@ -0,0 +1,6 @@
.foo.svelte-xyz, /* some comment */
.bar.svelte-xyz /* some other comment */
{
color: red;
}

@ -0,0 +1,10 @@
<div class="foo">foo</div>
<div class="bar">bar</div>
<style>
.foo, /* some comment */
.bar /* some other comment */
{
color: red;
}
</style>
Loading…
Cancel
Save