parent
69cfed6b31
commit
d4cc7b2496
@ -316,7 +316,7 @@ describe('renderer: teleport', () => {
|
||||
},
|
||||
render: compile(`
|
||||
<teleport :to="target" :disabled="disabled">
|
||||
<div>teleported</div><span>{{ disabled }}</span>
|
||||
<div>teleported</div><span>{{ disabled }}</span><span v-if="disabled"/>
|
||||
</teleport>
|
||||
<div>root</div>
|
||||
`)
|
||||
@ -326,13 +326,13 @@ describe('renderer: teleport', () => {
|
||||
`"<!--teleport start--><!--teleport end--><div>root</div>"`
|
||||
)
|
||||
expect(serializeInner(target)).toMatchInlineSnapshot(
|
||||
`"<div>teleported</div><span>false</span>"`
|
||||
`"<div>teleported</div><span>false</span><!--v-if-->"`
|
||||
)
|
||||
|
||||
disabled.value = true
|
||||
await nextTick()
|
||||
expect(serializeInner(root)).toMatchInlineSnapshot(
|
||||
`"<!--teleport start--><div>teleported</div><span>true</span><!--teleport end--><div>root</div>"`
|
||||
`"<!--teleport start--><div>teleported</div><span>true</span><span></span><!--teleport end--><div>root</div>"`
|
||||
)
|
||||
expect(serializeInner(target)).toBe(``)
|
||||
|
||||
@ -343,7 +343,7 @@ describe('renderer: teleport', () => {
|
||||
`"<!--teleport start--><!--teleport end--><div>root</div>"`
|
||||
)
|
||||
expect(serializeInner(target)).toMatchInlineSnapshot(
|
||||
`"<div>teleported</div><span>false</span>"`
|
||||
`"<div>teleported</div><span>false</span><!--v-if-->"`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -146,7 +146,10 @@ export const TeleportImpl = {
|
||||
const oldChildren = n1.children as VNode[]
|
||||
const children = n2.children as VNode[]
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
children[i].el = oldChildren[i].el
|
||||
// only inherit for non-patched nodes (i.e. static ones)
|
||||
if (!children[i].el) {
|
||||
children[i].el = oldChildren[i].el
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!optimized) {
|
||||
|
Loading…
Reference in New Issue
Block a user