Skip to content

Svelte 5: :nth-child(n+1) and :nth-of-type(n+1) do not compile #9765

@kran6a

Description

@kran6a

Describe the bug

The bug is self explanatory.

Reproduction

The following code causes the compiler to crash indicating the CSS identifier is invalid.

<style>
	h1:nth-of-type(2n+1){
        background: red;
    }
</style>

<h1>Broken</h1>
<h1>Broken</h1>
<h1>Broken</h1>

Svelte 5 REPL link

The same code compiles and works on Svelte 4 REPL.

Logs

No response

System Info

Not needed

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompilerChanges relating to the compilercssStuff related to Svelte's built-in CSS handling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions