fix(compiler-dom): comments in the v-if branchs should be ignored when used in Transition (#3622)
fix #3619
This commit is contained in:
@@ -34,7 +34,7 @@ import {
|
||||
OPEN_BLOCK,
|
||||
CREATE_VNODE
|
||||
} from '../runtimeHelpers'
|
||||
import { injectProp, findDir, findProp } from '../utils'
|
||||
import { injectProp, findDir, findProp, isBuiltInType } from '../utils'
|
||||
import { PatchFlags, PatchFlagNames } from '@vue/shared'
|
||||
|
||||
export const transformIf = createStructuralDirectiveTransform(
|
||||
@@ -146,7 +146,16 @@ export function processIf(
|
||||
// move the node to the if node's branches
|
||||
context.removeNode()
|
||||
const branch = createIfBranch(node, dir)
|
||||
if (__DEV__ && comments.length) {
|
||||
if (
|
||||
__DEV__ &&
|
||||
comments.length &&
|
||||
// #3619 ignore comments if the v-if is direct child of <transition>
|
||||
!(
|
||||
context.parent &&
|
||||
context.parent.type === NodeTypes.ELEMENT &&
|
||||
isBuiltInType(context.parent.tag, 'transition')
|
||||
)
|
||||
) {
|
||||
branch.children = [...comments, ...branch.children]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user