Skip to content

Commit 3d59e84

Browse files
fix: allow double hyphen css selector names (#15384)
1 parent c2ec0d9 commit 3d59e84

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.changeset/fast-pants-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: allow double hyphen css selector names

packages/svelte/src/compiler/phases/1-parse/read/style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,15 @@ function read_attribute_value(parser) {
566566
}
567567

568568
/**
569-
* https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
569+
* https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
570570
* @param {Parser} parser
571571
*/
572572
function read_identifier(parser) {
573573
const start = parser.index;
574574

575575
let identifier = '';
576576

577-
if (parser.match('--') || parser.match_regex(REGEX_LEADING_HYPHEN_OR_DIGIT)) {
577+
if (parser.match_regex(REGEX_LEADING_HYPHEN_OR_DIGIT)) {
578578
e.css_expected_identifier(start);
579579
}
580580

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
.--foo.svelte-xyz {
3+
color: red;
4+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="--foo"></div>
2+
3+
<style>
4+
.--foo {
5+
color: red;
6+
}
7+
</style>

0 commit comments

Comments
 (0)