Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0.0 broke comments on nested elements #164

Closed
pgorny opened this issue Oct 31, 2024 · 9 comments
Closed

7.0.0 broke comments on nested elements #164

pgorny opened this issue Oct 31, 2024 · 9 comments

Comments

@pgorny
Copy link

pgorny commented Oct 31, 2024

The change in #163 naively that was included in 7.0.0 expects the node contents to be something that can be included in a regex, but the problem is that both CSS and Regex share some syntax elements, including [] used for attribute selector and character classes, respectively.

This means that a simple code like this:

/* Comment */
&[data-roots-all] {
  display: none;
}

will now fail with

SyntaxError: Invalid regular expression: //* Comment */ *
*&[data-roots-all] {
   display: none;
}/: Range out of order in character class

This is due to the fact that [data-roots-all] is not treated as a literal, but rather a character class - and thus s-a class trips it up.

@ai
Copy link
Member

ai commented Oct 31, 2024

@Ulyanov-programmer can you look and fix?

@Ulyanov-programmer
Copy link
Contributor

I'll get on it as soon as possible. It will be necessary to add similar situations to the tests...

@Plumbiu
Copy link

Plumbiu commented Nov 1, 2024

It seems that comments cause a lot of problems:

.md {
  color: red;
  & > * {
    margin-bottom: 12px;
  }
  /* table */
  table {}
}

generated:

.md {
  color: red;
}
  .md .md * {
    margin-bottom: 12px;
  }
  /* table */
  table {
  }

@Ulyanov-programmer
Copy link
Contributor

It seems that comments cause a lot of problems:

I've already written about it to @ai in PR but for some reason he hasn't read about it.
I have already solved this problem, but for some reason the author of the repository did not consider it necessary to include this solution.

@ai
Copy link
Member

ai commented Nov 1, 2024

@Plumbiu the comment was moved correctly.

Where is the problem?

@Ulyanov-programmer
Copy link
Contributor

@Plumbiu the comment was moved correctly.

Where is the problem?

Nesting does not work)

@ai
Copy link
Member

ai commented Nov 1, 2024

I have already solved this problem, but for some reason the author of the repository did not consider it necessary to include this solution

Seems like I missed that there was a problem with selectors.

Can you send PR because it is regression?

@Ulyanov-programmer
Copy link
Contributor

Ulyanov-programmer commented Nov 1, 2024

I have already solved this problem, but for some reason the author of the repository did not consider it necessary to include this solution

Seems like I missed that there was a problem with selectors.

Can you send PR because it is regression?

#167

@ai
Copy link
Member

ai commented Nov 1, 2024

The fix was released in 7.0.2.

@ai ai closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants