mirror of https://github.com/sveltejs/svelte
fix: prevent infinite loops when pruning CSS (#14474)
fixes #14472 --------- Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/14480/head
parent
ca3690f7df
commit
a60e837e44
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent infinite loops when pruning CSS
|
@ -0,0 +1,20 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
warnings: [
|
||||
{
|
||||
code: 'css_unused_selector',
|
||||
message: 'Unused CSS selector "div + div"',
|
||||
start: {
|
||||
line: 19,
|
||||
column: 1,
|
||||
character: 185
|
||||
},
|
||||
end: {
|
||||
line: 19,
|
||||
column: 10,
|
||||
character: 194
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
|
||||
div div.svelte-xyz {
|
||||
color: green;
|
||||
}
|
||||
/* (unused) div + div {
|
||||
color: red; /* this is marked as unused, but only because we've written an infinite loop - worth fixing? *\/
|
||||
}*/
|
||||
div.svelte-xyz:has(div:where(.svelte-xyz)) {
|
||||
color: green;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
{#snippet a()}
|
||||
{@render b()}
|
||||
<div>
|
||||
{@render b()}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
{#snippet b()}
|
||||
{@render a()}
|
||||
<div>
|
||||
{@render a()}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<style>
|
||||
div div {
|
||||
color: green;
|
||||
}
|
||||
div + div {
|
||||
color: red; /* this is marked as unused, but only because we've written an infinite loop - worth fixing? */
|
||||
}
|
||||
div:has(div) {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue