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

css nesting lowering doesn't work when both a pseudo element selector and a class selector is used #3648

Closed
sapphi-red opened this issue Feb 15, 2024 · 1 comment

Comments

@sapphi-red
Copy link
Contributor

For this input,

.foo {
  &:after,
  & .bar {
    grid-area: 1 / 1 / 2 / 2;
  }
}

esbuild outputs

.foo .bar,
.foo .bar {
  grid-area: 1 / 1 / 2 / 2;
}

. I expect

.foo:after,
.foo .bar {
  grid-area: 1 / 1 / 2 / 2;
}

to be output.

Interestingly, the following works as expected:

.foo {
  & .bar,
  &:after
   {
    grid-area: 1 / 1 / 2 / 2;
  }

  &:after {
    grid-area: 1 / 1 / 2 / 2;
  }

  &:before,
  &:after {
    grid-area: 1 / 1 / 2 / 2;
  }
}

esbuild try

Original issue: vitejs/vite#15912

@evanw
Copy link
Owner

evanw commented Feb 15, 2024

Thanks for the report. It looks like this is not intentional. It was caused by incorrectly mutating the parent rule's selector list when filtering out pseudo elements for the child rules.

@evanw evanw closed this as completed in ad3d8c6 Feb 15, 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

2 participants