@@ -10,12 +10,12 @@ following the [Selectors Level 4] specification.
1010
1111``` css
1212body :has (:focus ) {
13- background-color : yellow ;
13+ background-color : yellow ;
1414}
1515
1616/* becomes */
1717
18- [body \: has\(\: focus \) ] {
18+ [csstools- has-2q-33-2s-3d-1m-2w-2p-37-14-1m-2u-33-2r-39-37-15 ] :not ( does-not-exist ) {
1919 background-color : yellow ;
2020}
2121
@@ -43,7 +43,7 @@ const postcss = require('postcss');
4343const cssHasPseudoExperimental = require (' @csstools/css-has-pseudo-experimental' );
4444
4545postcss ([
46- cssHasPseudoExperimental (/* pluginOptions */ )
46+ cssHasPseudoExperimental (/* pluginOptions */ )
4747]).process (YOUR_CSS /* , processOptions */ );
4848```
4949
@@ -66,13 +66,13 @@ cssHasPseudoExperimental({ preserve: false });
6666
6767``` css
6868body :has (:focus ) {
69- background-color : yellow ;
69+ background-color : yellow ;
7070}
7171
7272/* becomes */
7373
74- body [ \: has\(\: focus \) ] {
75- background-color : yellow ;
74+ [ csstools- has-2q-33-2s-3d-1m-2w-2p-37-14-1m-2u-33-2r-39-37-15 ] :not ( does-not-exist ) {
75+ background-color : yellow ;
7676}
7777```
7878
@@ -86,7 +86,7 @@ See how `:not` is used to modify [specificity](#specificity).
8686
8787``` js
8888postcss ([
89- cssHasPseudoExperimental ({ specificityMatchingName: ' something-random' })
89+ cssHasPseudoExperimental ({ specificityMatchingName: ' something-random' })
9090]).process (YOUR_CSS /* , processOptions */ );
9191```
9292
@@ -102,10 +102,10 @@ Before :
102102
103103After :
104104
105- [ specificity 1, 2, 0] ( https://polypane.app/css-specificity-calculator/#selector=%5B%5C.x%5C%3Ahas%5C(%5C%253E%5C%2520%5C%2523a%5C%3Ahover%5C) %5D%3Anot(%23does-not-exist)%3Anot(.does-not-exist) )
105+ [ specificity 1, 2, 0] ( https://polypane.app/css-specificity-calculator/#selector=%5Bcsstools-has-1a-3c-1m-2w-2p-37-14-1q-w-z-2p-1m-2w-33-3a-2t-36-15 %5D%3Anot(%23does-not-exist)%3Anot(.does-not-exist) )
106106
107107``` css
108- [\. x \: has\(\% 3E \% 20 \% 23a \: hover \) ]:not (#does-not-exist ):not (.does-not-exist ) {
108+ [csstools- has-1a-3c-1m-2w-2p-37-14-1q-w-z-2p-1m-2w-33-3a-2t-36-15 ]:not (#does-not-exist ):not (.does-not-exist ) {
109109 order : 11 ;
110110}
111111```
@@ -127,10 +127,10 @@ figure:has(> img)
127127
128128After :
129129
130- [specificity 0, 1, 2](https://polypane.app/css-specificity-calculator /#selector=%5Bfigure%5C%3Ahas%5C(%5C%253E%5C%2520img%5C) %5D%3Anot(does-not-exist )%3Anot(does-not-exist ))
130+ [specificity 0, 1, 2](https://polypane.app/css-specificity-calculator /#selector=%5Bcsstools-has-2u-2x-2v-39-36-2t-1m-2w-2p-37-14-1q-w-2x-31-2v-15 %5D%3Anot(does-not-exist )%3Anot(does-not-exist ))
131131
132132```css
133- [figure \: has\(\% 3E \% 20img \) ]:not (does-not-exist ):not (does-not-exist )
133+ [csstools- has-2u-2x-2v-39-36-2t-1m-2w-2p-37-14-1q-w-2x-31-2v-15 ]:not (does-not-exist ):not (does-not-exist )
134134```
135135
136136### Plugin order
@@ -152,14 +152,14 @@ The experimental plugin must be added after any other plugin that modifies selec
152152
153153```js
154154plugins: [
155- // other plugins
156- postcssPresetEnv({
157- features: {
158- ' css-has-pseudo' : false
159- }
160- }),
161- // other plugins
162- cssHasPseudoExperimental(), // last
155+ // other plugins
156+ postcssPresetEnv({
157+ features: {
158+ ' css-has-pseudo' : false
159+ }
160+ }),
161+ // other plugins
162+ cssHasPseudoExperimental(), // last
163163]
164164```
165165
0 commit comments