Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bwbroersma opened this issue Dec 20, 2023 · 0 comments · Fixed by #9970
Closed

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

bwbroersma opened this issue Dec 20, 2023 · 0 comments · Fixed by #9970

Comments

@bwbroersma
Copy link
Contributor

bwbroersma commented Dec 20, 2023

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

@bwbroersma bwbroersma changed the title Svelte 5: :nth-of-type(10) and :nth-of-type(10n) (two digits) do not compile Svelte 5: :nth-of-type(10) and :nth-of-type(10n[+1]) (> 1 digit) do not compile Dec 20, 2023
dummdidumm pushed a commit that referenced this issue Jan 2, 2024
closes #9969

this also fixes the following along the way:
the + in nth-of-type(+xn-b) would be parsed as a combinator.

invalid cases like these are not allowed anymore:

b(+/-)b
-ax
-ax-b
-b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant