[fix] hydrate correct elements when using @html
#6946
Merged
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.
fixes #7115
After executing this line from Kit,
nodes
contains (maybe unexpected)#text
node at the top and end.svelte/src/runtime/internal/Component.ts
Line 161 in 03ef0e4
In this case,
start_index
is more than 0 (mostly 1).And the second argument of
splice
is delete_count.Therefore it will splice more than expected.
svelte/src/runtime/internal/dom.ts
Line 504 in 03ef0e4
If
start_index
is possibly more than 0, I think it should be modified to look like this PR.On the other hand, should we prevent containing unexpected
#text
nodes at the top and end?I think we can not control it because a template file containing
%svelte.body%
can be freely created by a user.Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint