cssinjs / cssinjs/jss

[nested] Nested selectors are not calculated properly with `$` in it

Open
#1,321 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__Expected behavior:__
Nested selectors should include escaped `$` in its parent's selector

__Describe the bug:__
selectors that are nested drop the `$` and keep the escape backslash, while their parent selector includes `\$`.

1. Open up [https://cssinjs.org/repl](https://cssinjs.org/repl)
1. On line 23, change the selector to `'$Button'` or `'\$Button'`
1. Observe the nested selectors generated

The issue happened in my react app where components are mangled by webpack, and some of them starts with `$` (like `$z`). In that situation, the nested selectors do not work.

__Codesandbox link:__
Just use the [https://cssinjs.org/repl](https://cssinjs.org/repl)

__Versions (please complete the following information):__
- jss: 10.0.0
- Browser [e.g. chrome, safari]: chrome
- OS [e.g. Windows, macOS]: windows
Feel free to add any additional versions which you may think are relevant to the bug.

![Annotation 2020-03-25 174036](https://user-images.githubusercontent.com/27591843/77598837-1eef5900-6ec0-11ea-9c0b-1c1f1b0b8006.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.