"combinators" found in `nth-child` expressions

Open
#14 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Reproduce the issue with the selectors .foo:nth-child(2n + 1) and .foo:nth-child(2n - 1) through the selector parser. Trace how nth-child expressions are tokenized and verify that the plus or minus signs and surrounding spaces are not classified as combinators. Done means both expressions parse with their arithmetic content preserved and without spurious combinator nodes.

Written by the indexing model from the issue text.

Description

enhancement help wanted

Another nth-child problem ...

Given the selector .foo:nth-child(2n + 1), the parser thinks that plus sign is a combinator.

Given the selector .foo:nth-child(2n - 1), the parser thinks the spaces around the minus signs are combinators.

Dominant language
JavaScript
Stars
214
Forks
63
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from postcss/postcss-selector-parser

All issues in postcss/postcss-selector-parser

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.