fix html tag hydration

pull/9184/head
Kelvin Soh 3 years ago
parent 4b911045b0
commit f59bf85bcf

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: more robust hydration of html tag

@ -807,6 +807,9 @@ export function claim_html_tag(nodes, is_svg) {
detach(html_tag_nodes[0]); detach(html_tag_nodes[0]);
detach(html_tag_nodes[html_tag_nodes.length - 1]); detach(html_tag_nodes[html_tag_nodes.length - 1]);
const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1); const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);
if (claimed_nodes.length === 0) {
return new HtmlTagHydration(is_svg);
}
for (const n of claimed_nodes) { for (const n of claimed_nodes) {
n.claim_order = nodes.claim_info.total_claimed; n.claim_order = nodes.claim_info.total_claimed;
nodes.claim_info.total_claimed += 1; nodes.claim_info.total_claimed += 1;

@ -0,0 +1 @@
1 <!-- HTML_TAG_START -->2<!-- HTML_TAG_END --> 3

@ -0,0 +1,5 @@
<script>
const a = 1, b=2, c=3;
</script>
{a} {@html b} {c}
Loading…
Cancel
Save