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

"&" selector not preserved inside @scope #700

Open
axyz opened this issue Mar 14, 2024 · 0 comments
Open

"&" selector not preserved inside @scope #700

axyz opened this issue Mar 14, 2024 · 0 comments

Comments

@axyz
Copy link

axyz commented Mar 14, 2024

Hi, I noticed an issue with @scope at rules.

When the & selector is used, it does not get preserved and it gets substituted with a :scope selector

can be verified here

Beside being slightly longer for the sake of minification, the selector should be preserved as it is (either & or :scope) due to the different impact on specificity.

Additionally & supports reuse in the same selector.

e.g.

@scope(.foo) {
  & &  {
    --color: yellow;
  }
}

this is valid in CSS, but using lightningcss it outputs

@scope (.foo) {
  :scope :scope {
    --color: yellow;
  }
}

that is invalid. playground here

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

1 participant