From: daiwei Date: Sat, 1 Feb 2025 03:37:03 +0000 (+0800) Subject: chore: update X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7e11639d5efb32e1fecd4b99ce7df36b4268217;p=thirdparty%2Fvuejs%2Fcore.git chore: update --- diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index aa94eb0961..bc938b5877 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -19,6 +19,7 @@ import { ShapeFlags, def, getEscapedCssVarName, + hasOwn, includeBooleanAttr, isBooleanAttr, isKnownHtmlAttr, @@ -677,7 +678,7 @@ export function createHydrationFunctions( ): Node | null => { if ( !isMismatchAllowed(node.parentElement!, MismatchTypes.CHILDREN) && - !isCommentNodeMismatch(node, vnode) + !isMismatchAllowedForCommentNode(node, vnode) ) { ;(__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn( @@ -998,10 +999,13 @@ function isMismatchAllowed( } // data-allow-mismatch + v-if -function isCommentNodeMismatch(node: Node, vnode: VNode): boolean { - if (node.nodeType !== DOMNodeTypes.COMMENT || !vnode.props) { - return false - } - - return allowMismatchAttr in vnode.props +function isMismatchAllowedForCommentNode( + node: Node, + { props }: VNode, +): boolean { + return ( + node.nodeType === DOMNodeTypes.COMMENT && + props != null && + hasOwn(props, allowMismatchAttr) + ) }