@@ -18,12 +18,12 @@ const creator: PluginCreator<{ preserve?: boolean, specificityMatchingName?: str
18
18
return {
19
19
postcssPlugin : 'css-has-pseudo-experimental' ,
20
20
RuleExit : ( rule , { result } ) => {
21
- if ( ! rule . selector . includes ( ':has(' ) || isWithinSupportCheck ( rule ) ) {
21
+ if ( ! rule . selector . toLowerCase ( ) . includes ( ':has(' ) || isWithinSupportCheck ( rule ) ) {
22
22
return ;
23
23
}
24
24
25
25
const selectors = rule . selectors . map ( ( selector ) => {
26
- if ( ! selector . includes ( ':has(' ) ) {
26
+ if ( ! selector . toLowerCase ( ) . includes ( ':has(' ) ) {
27
27
return selector ;
28
28
}
29
29
@@ -41,7 +41,7 @@ const creator: PluginCreator<{ preserve?: boolean, specificityMatchingName?: str
41
41
42
42
let containsHasPseudo = false ;
43
43
selectorAST . walkPseudos ( ( node ) => {
44
- containsHasPseudo = containsHasPseudo || ( node . value === ':has' && node . nodes ) ;
44
+ containsHasPseudo = containsHasPseudo || ( node . value . toLowerCase ( ) === ':has' && node . nodes ) ;
45
45
46
46
// see : https://bugs.chromium.org/p/chromium/issues/detail?id=669058#c34
47
47
// When we have ':has(:visited) {...}', the subject elements of the rule
@@ -51,15 +51,15 @@ const creator: PluginCreator<{ preserve?: boolean, specificityMatchingName?: str
51
51
// selector does not match if it is inside the ':has()' argument selector.
52
52
// So if a ':has()' argument selector requires a matching ':visited', the
53
53
// style rule are not applied.
54
- if ( node . value === ':visited' ) {
54
+ if ( node . value . toLowerCase ( ) === ':visited' ) {
55
55
// We can't leave `:has` untouched as that might cause broken selector lists.
56
56
// Replacing with the specificity matching name as this should never match anything without `:not()`.
57
57
node . replaceWith ( parser . className ( {
58
58
value : options . specificityMatchingName ,
59
59
} ) ) ;
60
60
}
61
61
62
- if ( node . value === ':any-link' ) {
62
+ if ( node . value . toLowerCase ( ) === ':any-link' ) {
63
63
// we can transform `:any-link` to `:link` as this is allowed
64
64
node . value = ':link' ;
65
65
}
0 commit comments