fix(parser): fix crash when css variable property does not end with a semicolon (#3700)

Fixes #3698 #3373
This commit is contained in:
Ben Kelly
2023-01-14 19:55:14 -05:00
committed by GitHub
parent eefe33a47f
commit 0e99701e00
3 changed files with 16 additions and 2 deletions

View File

@@ -1551,7 +1551,7 @@ const Parser = function Parser(context, imports, fileInfo) {
// Custom property values get permissive parsing
if (name[0].value && name[0].value.slice(0, 2) === '--') {
value = this.permissiveValue();
value = this.permissiveValue(/[;}]/);
}
// Try to store values as anonymous
// If we need the value later we'll re-parse it in ruleset.parseValue

View File

@@ -35,3 +35,12 @@ foo[attr="blah"] {
--value: a /* { ; } */;
--comment-within: ( /* okay?; comment; */ );
}
.test-no-trailing-semicolon {
--value: foo;
}
.test-no-trailing-semicolon2 {
--value: foo;
}
.test-no-trailing-semicolon3 {
--value: foo;
}

View File

@@ -47,4 +47,9 @@
.test-rule-comment {
--value: a/* { ; } */;
--comment-within: ( /* okay?; comment; */ );
}
}
.test-no-trailing-semicolon {
--value: foo
}
.test-no-trailing-semicolon2 {--value: foo}
.test-no-trailing-semicolon3 { --value: foo }