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

Ligthning generate :is with pseudo element #352

Open
bakura10 opened this issue Dec 8, 2022 · 5 comments
Open

Ligthning generate :is with pseudo element #352

bakura10 opened this issue Dec 8, 2022 · 5 comments

Comments

@bakura10
Copy link

bakura10 commented Dec 8, 2022

Hi,

Considering the following code:

.foo {
  &::before {
    .bar & {
      color: blue;
    }
  }
}

ParcelCSS will generate the following CSS:

.bar :is(.foo:before){color:#00f}

Playground URL

However, using a pseudo element selector is not valid inside :is, so it should generate this instead:

.bar .foo:before{color:#00f}
@devongovett
Copy link
Member

devongovett commented Dec 8, 2022

Actually I'm not convinced that this is valid for nesting either... https://drafts.csswg.org/css-nesting/#example-7145ff1e

Related: w3c/csswg-drafts#7433

@bakura10
Copy link
Author

bakura10 commented Dec 9, 2022

It seems you're right, this is a very odd limitation. Maybe Parcel should emit a warning here, I can imagine I won't be the first being caught by surprise here :D

@fuweichin
Copy link

For lightningcss 1.0.0-alpha.55, the double semicolon :: of psuedo-element selector will always be transformed to single semicolon : (as psuedo-class selector) during bundle process regardless of browserslist. This doesn't make sense especially when the --minify option is not used.

@yisibl
Copy link
Contributor

yisibl commented Jun 20, 2024

It seems you're right, this is a very odd limitation. Maybe Parcel should emit a warning here, I can imagine I won't be the first being caught by surprise here :D

I filed a separate issue: #760

@yisibl
Copy link
Contributor

yisibl commented Jun 20, 2024

For the following styles

input

dialog:modal, dialog:modal::backdrop {
  @starting-style {
    opacity: 0;
  }
  opacity: 1;
}

output

dialog:modal {
  opacity: 1;
}

@starting-style {
  dialog:modal {
    opacity: 0;
  }
}

dialog:modal::backdrop {
  opacity: 1;
}

@starting-style {
  dialog:modal::backdrop {
    opacity: 0;
  }
}

expected

dialog:modal, dialog:modal::backdrop {
  opacity: 1;
}
@starting-style {
  dialog:modal, dialog:modal::backdrop {
    opacity: 0;
  }
}

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