-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: correctly prune key/each blocks #14403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1c753b2
fix: correctly prune key blocks
Rich-Harris 532954b
fix pruning of each blocks
Rich-Harris f74d357
simplify
Rich-Harris 68b5a8e
make more explicit
Rich-Harris 1b30e7f
changeset
Rich-Harris 8a5e6dc
helperise/robustify
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.