-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly prune key/each blocks (#14403)
* fix: correctly prune key blocks * fix pruning of each blocks * simplify * make more explicit * changeset * helperise/robustify
- Loading branch information
1 parent
e721d96
commit 37e6c7f
Showing
13 changed files
with
156 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: correctly prune each blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: correctly prune key blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/css/samples/general-siblings-combinator-key/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
warnings: [] | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/svelte/tests/css/samples/general-siblings-combinator-key/expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.a.svelte-xyz ~ .b:where(.svelte-xyz) { color: green; } | ||
.a.svelte-xyz ~ .c:where(.svelte-xyz) { color: green; } | ||
.b.svelte-xyz ~ .c:where(.svelte-xyz) { color: green; } |
13 changes: 13 additions & 0 deletions
13
packages/svelte/tests/css/samples/general-siblings-combinator-key/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="a"></div> | ||
|
||
{#key x} | ||
<div class="b"></div> | ||
{/key} | ||
|
||
<div class="c"></div> | ||
|
||
<style> | ||
.a ~ .b { color: green; } | ||
.a ~ .c { color: green; } | ||
.b ~ .c { color: green; } | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 11 additions & 10 deletions
21
packages/svelte/tests/css/samples/siblings-combinator-each-else-nested/expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
|
||
.a.svelte-xyz + .e:where(.svelte-xyz) { color: green; } | ||
.a.svelte-xyz + .f:where(.svelte-xyz) { color: green; } | ||
.a.svelte-xyz + .g:where(.svelte-xyz) { color: green; } | ||
.b.svelte-xyz + .c:where(.svelte-xyz) { color: green; } | ||
.b.svelte-xyz + .d:where(.svelte-xyz) { color: green; } | ||
.c.svelte-xyz + .e:where(.svelte-xyz) { color: green; } | ||
.c.svelte-xyz + .f:where(.svelte-xyz) { color: green; } | ||
.c.svelte-xyz + .g:where(.svelte-xyz) { color: green; } | ||
.c.svelte-xyz + .k:where(.svelte-xyz) { color: green; } | ||
.d.svelte-xyz + .e:where(.svelte-xyz) { color: green; } | ||
.d.svelte-xyz + .f:where(.svelte-xyz) { color: green; } | ||
.e.svelte-xyz + .e:where(.svelte-xyz) { color: green; } | ||
.i.svelte-xyz + .j:where(.svelte-xyz) { color: green; } | ||
.g.svelte-xyz + .h:where(.svelte-xyz) + .j:where(.svelte-xyz) { color: green; } | ||
.g.svelte-xyz + .i:where(.svelte-xyz) + .j:where(.svelte-xyz) { color: green; } | ||
.g.svelte-xyz + .j:where(.svelte-xyz) { color: green; } | ||
.m.svelte-xyz + .m:where(.svelte-xyz) { color: green; } | ||
.m.svelte-xyz + .l:where(.svelte-xyz) { color: green; } | ||
.l.svelte-xyz + .m:where(.svelte-xyz) { color: green; } | ||
|
||
/* no match */ | ||
/* (unused) .a + .c { color: green; }*/ | ||
/* (unused) .a + .g { color: green; }*/ | ||
/* (unused) .b + .e { color: green; }*/ | ||
/* (unused) .c + .g { color: green; }*/ | ||
/* (unused) .c + .k { color: green; }*/ | ||
/* (unused) .d + .d { color: green; }*/ | ||
/* (unused) .e + .f { color: green; }*/ | ||
/* (unused) .f + .f { color: green; }*/ | ||
/* (unused) .g + .j { color: green; }*/ | ||
/* (unused) .g + .h + .i + .j { color: green; }*/ | ||
/* (unused) .a + .c { color: red; }*/ | ||
/* (unused) .b + .e { color: red; }*/ | ||
/* (unused) .d + .d { color: red; }*/ | ||
/* (unused) .e + .f { color: red; }*/ | ||
/* (unused) .f + .f { color: red; }*/ | ||
/* (unused) .g + .h + .i + .j { color: red; }*/ |
2 changes: 1 addition & 1 deletion
2
packages/svelte/tests/css/samples/siblings-combinator-each-else-nested/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="a svelte-xyz"></div> | ||
<div class="f svelte-xyz"></div> | ||
<div class="k"></div> | ||
<div class="k svelte-xyz"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/svelte/tests/css/samples/siblings-combinator-key/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
warnings: [ | ||
{ | ||
code: 'css_unused_selector', | ||
message: 'Unused CSS selector ".a + .c"', | ||
start: { character: 166, column: 1, line: 14 }, | ||
end: { character: 173, column: 8, line: 14 } | ||
} | ||
] | ||
}); |
6 changes: 6 additions & 0 deletions
6
packages/svelte/tests/css/samples/siblings-combinator-key/expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
.a.svelte-xyz + .b:where(.svelte-xyz) { color: green; } | ||
.b.svelte-xyz + .c:where(.svelte-xyz) { color: green; } | ||
|
||
/* no match */ | ||
/* (unused) .a + .c { color: red; }*/ |
Oops, something went wrong.