@@ -10,12 +10,12 @@ following the [Selectors Level 4] specification.
10
10
11
11
``` css
12
12
body :has (:focus ) {
13
- background-color : yellow ;
13
+ background-color : yellow ;
14
14
}
15
15
16
16
/* becomes */
17
17
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 ) {
19
19
background-color : yellow ;
20
20
}
21
21
@@ -43,7 +43,7 @@ const postcss = require('postcss');
43
43
const cssHasPseudoExperimental = require (' @csstools/css-has-pseudo-experimental' );
44
44
45
45
postcss ([
46
- cssHasPseudoExperimental (/* pluginOptions */ )
46
+ cssHasPseudoExperimental (/* pluginOptions */ )
47
47
]).process (YOUR_CSS /* , processOptions */ );
48
48
```
49
49
@@ -66,13 +66,13 @@ cssHasPseudoExperimental({ preserve: false });
66
66
67
67
``` css
68
68
body :has (:focus ) {
69
- background-color : yellow ;
69
+ background-color : yellow ;
70
70
}
71
71
72
72
/* becomes */
73
73
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 ;
76
76
}
77
77
```
78
78
@@ -86,7 +86,7 @@ See how `:not` is used to modify [specificity](#specificity).
86
86
87
87
``` js
88
88
postcss ([
89
- cssHasPseudoExperimental ({ specificityMatchingName: ' something-random' })
89
+ cssHasPseudoExperimental ({ specificityMatchingName: ' something-random' })
90
90
]).process (YOUR_CSS /* , processOptions */ );
91
91
```
92
92
@@ -102,10 +102,10 @@ Before :
102
102
103
103
After :
104
104
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) )
106
106
107
107
``` 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 ) {
109
109
order : 11 ;
110
110
}
111
111
```
@@ -127,10 +127,10 @@ figure:has(> img)
127
127
128
128
After :
129
129
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 ))
131
131
132
132
```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 )
134
134
```
135
135
136
136
### Plugin order
@@ -152,14 +152,14 @@ The experimental plugin must be added after any other plugin that modifies selec
152
152
153
153
```js
154
154
plugins: [
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
163
163
]
164
164
```
165
165
0 commit comments