- From: Romain Menke via GitHub <sysbot+gh@w3.org>
- Date: Sun, 23 Jan 2022 08:20:43 +0000
- To: public-css-archive@w3.org
Adding a bit more context from `postcss-nesting` plugin. The example above fed to the plugin. `pbpaste | npx @csstools/csstools-cli postcss-nesting --no-map` Source ```pcss .a { color: blue; & .b { @nest :not(.c)& { color: red } } } ``` Result ``` .a { color: blue } :not(.c):is(.a .b) { color: red } ``` ------ `pbpaste | npx @csstools/csstools-cli postcss-nesting --no-map --plugin-options '{ "noIsPseudoSelector": true }'` Source ```pcss .a { color: blue; & .b { @nest :not(.c)& { color: red } } } ``` Result ``` .a { color: blue } .a:not(.c) .b { color: red } ``` ----------- This behaviour is not intended as a feature or an operating mode. The flag exists to give CSS authors to option of having CSS output without `:is()` selectors. This was added because browser support for `:is()` is not good enough yet. We could do a better job explaining that this flag should be avoided as it introduces two issues : specificity and complex selector matching. see : https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#noispseudoselector There is now also a plugin for `:is()` which can almost match specificity behaviour of `:is()`. This works well enough and is better than not doing anything for specificity. see : https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-is-pseudo-class#%EF%B8%8F-known-shortcomings However for complex selectors there is not much we can do. It is not possible to write a single selector transform that removes `:is()` and always matches the same element. If there was a way we would not have needed `:is()`. -- GitHub Notification of comment by romainmenke Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6977#issuecomment-1019436573 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 23 January 2022 08:20:44 UTC