JSS plugin nested => incorrect nesting complex selector
- Dominant language
- JavaScript
- Stars
- 7.1k
- Forks
- 386
- PR merge metrics
- No merged PRs in 30d
Description
Hi, i found a bug:
if nesting with any pseudo class like `:is()` & `:where()` that contains two/more sub selector inside the `(...)`,
the strange result occured:
```
export default {
'btn': {
'&:is(.hello, .world)': {
color: 'red'
},
'&:where(.hello, .world)': {
color: 'red'
},
'&:not(:where(.hello, .world))': {
color: 'red'
},
}
}
```
the expected result:
```
.btn-0-1-114:is(.hello, .world) {
color: red;
}
.btn-0-1-114:where(.hello, .world) {
color: red;
}
.btn-0-1-114:not(:where(.hello, .world)) {
color: red;
}
```
but i got:
```
.btn-0-1-114:is(.hello, .btn-0-1-114 .world) {
color: red;
}
.btn-0-1-114:where(.hello, .btn-0-1-114 .world) {
color: red;
}
.btn-0-1-114:not(:where(.hello, .btn-0-1-114 .world)) {
color: red;
}
```
I think the `jss-plugin-extend` just splitting the selector list with comma and then merging each of it with parent selector.
it doesn't aware of `parentheses balancing`
Contributor guide
Research direction
Start with the JSS nesting plugin and reproduce the reported selectors containing :is(), :where(), and :not(:where(...)). Check how selector lists inside parentheses are split and compare the generated CSS with the expected output in this issue. Done means nested pseudo-class selectors preserve their internal comma-separated alternatives without incorrectly adding the parent selector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100