File tree 2 files changed +10
-20
lines changed
packages/runtime-core/src
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'
17
17
import {
18
18
PatchFlags ,
19
19
ShapeFlags ,
20
+ def ,
20
21
includeBooleanAttr ,
21
22
isBooleanAttr ,
22
23
isKnownHtmlAttr ,
@@ -141,18 +142,8 @@ export function createHydrationFunctions(
141
142
vnode . el = node
142
143
143
144
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 )
156
147
}
157
148
158
149
if ( patchFlag === PatchFlags . BAIL ) {
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {
33
33
NOOP ,
34
34
PatchFlags ,
35
35
ShapeFlags ,
36
+ def ,
36
37
getGlobalThis ,
37
38
invokeArrayFns ,
38
39
isArray ,
@@ -696,15 +697,10 @@ function baseCreateRenderer(
696
697
}
697
698
698
699
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 )
707
702
}
703
+
708
704
if ( dirs ) {
709
705
invokeDirectiveHook ( vnode , null , parentComponent , 'beforeMount' )
710
706
}
@@ -805,6 +801,9 @@ function baseCreateRenderer(
805
801
optimized : boolean ,
806
802
) => {
807
803
const el = ( n2 . el = n1 . el ! )
804
+ if ( __DEV__ || __FEATURE_PROD_DEVTOOLS__ ) {
805
+ el . __vnode = n2
806
+ }
808
807
let { patchFlag, dynamicChildren, dirs } = n2
809
808
// #1426 take the old vnode's patch flag into account since user may clone a
810
809
// compiler-generated vnode, which de-opts to FULL_PROPS
You can’t perform that action at this time.
0 commit comments