Skip to content

Svelte 5: :nth-of-type(10) and :nth-of-type(10n[+1]) (> 1 digit) do not compile #9969

@bwbroersma

Description

@bwbroersma

Describe the bug

Valid CSS does not compile.

li:nth-of-type(10) {color: red;} /* breaks */
li:nth-of-type(10n) {color: green;} /* breaks */
li:nth-of-type(10n+1) {color: blue;} /* breaks */
li:nth-of-type(1n+10) {color: yellow;} /* works */

Reproduction

<style>
	li:nth-of-type(10n) {color: red;}
	li:nth-of-type(11) {color: green;}
</style>
<ol>
{#each new Array(12) as x, i}
	<li>{i+1}</li>
{/each}
</ol>

REPL Svelte 5 variant does not compile in v5.0.0-next.26.

gives

Error compiling App.svelte
Expected a valid CSS identifier
line 2 column 16

REPL Svelte 4 variant compiles.

Logs

-

System Info

REPL - v5.0.0-next.26

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions