wip(hydration): hydrate multi-element static nodes

This commit is contained in:
Evan You
2020-05-15 16:30:20 -04:00
parent 1184118d23
commit dc229bcda4
2 changed files with 34 additions and 2 deletions

View File

@@ -117,7 +117,18 @@ export function createHydrationFunctions(
if (domType !== DOMNodeTypes.ELEMENT) {
return onMismatch()
}
return nextSibling(node)
// determine anchor, adopt content
let content = ''
let cur = node
for (let i = 0; i < vnode.staticCount; i++) {
content += (cur as Element).outerHTML
if (i === vnode.staticCount - 1) {
vnode.anchor = cur
}
cur = nextSibling(cur)!
}
vnode.children = content
return cur
case Fragment:
if (!isFragmentStart) {
return onMismatch()