|
|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
/** @import { Visitors } from 'zimmerframe' */
|
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
|
import { walk } from "zimmerframe";
|
|
|
|
|
import * as w from "../../../warnings.js";
|
|
|
|
|
import { is_keyframes_node } from "../../css.js";
|
|
|
|
|
import { walk } from 'zimmerframe';
|
|
|
|
|
import * as w from '../../../warnings.js';
|
|
|
|
|
import { is_keyframes_node } from '../../css.js';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {AST.CSS.StyleSheet} stylesheet
|
|
|
|
|
@ -19,7 +19,7 @@ const visitors = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
PseudoClassSelector(node, context) {
|
|
|
|
|
if (node.name === "is" || node.name === "where") {
|
|
|
|
|
if (node.name === 'is' || node.name === 'where') {
|
|
|
|
|
context.next();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -27,15 +27,11 @@ const visitors = {
|
|
|
|
|
if (
|
|
|
|
|
!node.metadata.used &&
|
|
|
|
|
// prevent double-marking of `.unused:is(.unused)`
|
|
|
|
|
(context.path.at(-2)?.type !== "PseudoClassSelector" ||
|
|
|
|
|
/** @type {AST.CSS.ComplexSelector} */ (context.path.at(-4))?.metadata
|
|
|
|
|
.used)
|
|
|
|
|
(context.path.at(-2)?.type !== 'PseudoClassSelector' ||
|
|
|
|
|
/** @type {AST.CSS.ComplexSelector} */ (context.path.at(-4))?.metadata.used)
|
|
|
|
|
) {
|
|
|
|
|
const content = context.state.stylesheet.content;
|
|
|
|
|
const text = content.styles.substring(
|
|
|
|
|
node.start - content.start,
|
|
|
|
|
node.end - content.start,
|
|
|
|
|
);
|
|
|
|
|
const text = content.styles.substring(node.start - content.start, node.end - content.start);
|
|
|
|
|
w.css_unused_selector(node, text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -47,5 +43,5 @@ const visitors = {
|
|
|
|
|
} else {
|
|
|
|
|
context.next();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|