fix: allow comments after last selector in css (#11723)

Fixes #11721
pull/11726/head
Paolo Ricciuti 1 year ago committed by GitHub
parent 0128df33da
commit 6d2f1a48b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

@ -139,7 +139,7 @@ function read_selector_list(parser, inside_pseudo_class = false) {
const end = parser.index;
parser.allow_whitespace();
allow_comment_or_whitespace(parser);
if (inside_pseudo_class ? parser.match(')') : parser.match('{')) {
return {
@ -324,7 +324,7 @@ function read_selector(parser, inside_pseudo_class = false) {
}
const index = parser.index;
parser.allow_whitespace();
allow_comment_or_whitespace(parser);
if (parser.match(',') || (inside_pseudo_class ? parser.match(')') : parser.match('{'))) {
// 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