csstree / csstree/csstree

Error character problems caused by pseudo-class content being escaped

Open
#179 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

Hello!

I found in my use that once the content of the pseudo-class has the '\\' symbol, it will be escaped to the wrong '' character, which is reproduced below.

```css
.iconfont:before {
content: "\e600";
}
```

Then run:

```javascript
const cssAST = csstree.parse(css)
const finalCSS = csstree.generate(cssPlain)
```

In the generated CSS, the expected result is escaped and will look like this:

```css
.iconfont:before{content:""}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied JavaScript reproduction using csstree.parse and csstree.generate, and compare the generated output with the CSS input containing content: "\e600". Done means generation preserves the escaped pseudo-class content instead of emitting the private-use character shown in the report.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.