postcss / postcss-selector-matches

PostCSS plugin to transform :matches() W3C CSS pseudo class to more compatible CSS (simpler selectors)
MIT License
44 stars 10 forks source link

2.0.2 and 2.0.3 produce garbled output when used with postcss-custom-selectors #10

Closed rgrove closed 7 years ago

rgrove commented 7 years ago

PR #8, which was released in 2.0.2, seems to break postcss-custom-selectors.

Here's a simple repro:

Input

@custom-selector :--link a, a:active, a:visited;

:--link.foo,
.foo {
  color: green;
}

Expected Output

This is what you get with postcss-selector-matches <= 2.0.1.

a.foo,
a:active.foo,
a:visited.foo,
.foo {
  color: green;
}

Actual Output

This is what you get starting with postcss-selector-matches 2.0.2. Note the garbled o.fo classname.

a.foo,
a:active.foo,
a:visited.foo,
o.fo {
  color: green;
}
TehShrike commented 7 years ago

As of 2.0.2, the "should works with weird identifiers" test in postcss-custom-selectors started failing: https://github.com/postcss/postcss-custom-selectors/blob/cf0f7dcb82797f3d3475efd431b48ff273abbec2/test/index.js#L169-L195

MoOx commented 7 years ago

@yordis can you take a look to this?

MoOx commented 7 years ago

Should be fixed in 2.0.4. The change in 2.0.2 was really dangerous.

rgrove commented 7 years ago

@MoOx Thanks!

rgrove commented 7 years ago

Looks like 2.0.4 didn't quite fix everything. I've simplified the test case from this issue's description and added it as a failing unit test in PR #12.