This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { warn } from './warning'
1717import {
1818 PatchFlags ,
1919 ShapeFlags ,
20+ def ,
2021 includeBooleanAttr ,
2122 isBooleanAttr ,
2223 isKnownHtmlAttr ,
@@ -141,18 +142,8 @@ export function createHydrationFunctions(
141142 vnode . el = node
142143
143144 if ( __DEV__ || __FEATURE_PROD_DEVTOOLS__ ) {
144- if ( ! ( '__vnode' in node ) ) {
145- Object . defineProperty ( node , '__vnode' , {
146- value : vnode ,
147- enumerable : false ,
148- } )
149- }
150- if ( ! ( '__vueParentComponent' in node ) ) {
151- Object . defineProperty ( node , '__vueParentComponent' , {
152- value : parentComponent ,
153- enumerable : false ,
154- } )
155- }
145+ def ( node , '__vnode' , vnode , true )
146+ def ( node , '__vueParentComponent' , parentComponent , true )
156147 }
157148
158149 if ( patchFlag === PatchFlags . BAIL ) {
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {
3333 NOOP ,
3434 PatchFlags ,
3535 ShapeFlags ,
36+ def ,
3637 getGlobalThis ,
3738 invokeArrayFns ,
3839 isArray ,
@@ -696,15 +697,10 @@ function baseCreateRenderer(
696697 }
697698
698699 if ( __DEV__ || __FEATURE_PROD_DEVTOOLS__ ) {
699- Object . defineProperty ( el , '__vnode' , {
700- value : vnode ,
701- enumerable : false ,
702- } )
703- Object . defineProperty ( el , '__vueParentComponent' , {
704- value : parentComponent ,
705- enumerable : false ,
706- } )
700+ def ( el , '__vnode' , vnode , true )
701+ def ( el , '__vueParentComponent' , parentComponent , true )
707702 }
703+
708704 if ( dirs ) {
709705 invokeDirectiveHook ( vnode , null , parentComponent , 'beforeMount' )
710706 }
@@ -805,6 +801,9 @@ function baseCreateRenderer(
805801 optimized : boolean ,
806802 ) => {
807803 const el = ( n2 . el = n1 . el ! )
804+ if ( __DEV__ || __FEATURE_PROD_DEVTOOLS__ ) {
805+ el . __vnode = n2
806+ }
808807 let { patchFlag, dynamicChildren, dirs } = n2
809808 // #1426 take the old vnode's patch flag into account since user may clone a
810809 // compiler-generated vnode, which de-opts to FULL_PROPS
You can’t perform that action at this time.
0 commit comments