fix: remove incorrect special handling of :export pseudo-selectors (#18839)

#18793 added special handling for `:export` selectors, but this is
incorrect. `:export` is (apparently) part of [Interoperable
CSS](https://github.com/css-modules/icss) but Svelte doesn't (and
shouldn't) know what that is. No changeset because #18793 is unreleased,
and the changeset in that PR didn't mention ICSS
pull/18750/head
Rich Harris 4 days ago committed by GitHub
parent a72dc8eadb
commit 8030ff2a2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -146,16 +146,9 @@ export function prune(stylesheet, elements) {
ComplexSelector(node) {
const selectors = get_relative_selectors(node);
const rule = /** @type {Compiler.AST.CSS.Rule} */ (node.metadata.rule);
const first = selectors[0]?.selectors[0];
const is_icss_export =
selectors.length === 1 &&
selectors[0].selectors.length === 1 &&
first?.type === 'PseudoClassSelector' &&
first.name === 'export' &&
first.args === null;
// Global and ICSS export rules do not depend on an element in this component
if (every_is_global(selectors, 0, selectors.length, rule) || is_icss_export) {
if (every_is_global(selectors, 0, selectors.length, rule)) {
node.metadata.used = true;
}

@ -1,2 +1 @@
:export { foo: red; }
:is(td, th) { color: red; }

@ -1,6 +1,5 @@
<svelte:head><meta name="x" content="y" /></svelte:head>
<style>
:export { foo: red; }
:is(:global(td), :global(th)) { color: red; }
</style>

Loading…
Cancel
Save