File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed
platforms/web/runtime/modules Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ declare interface VNodeData {
45
45
on ?: ?{ [ key : string ] : Function | Array < Function > } ;
46
46
nativeOn ?: { [ key : string ] : Function | Array < Function > } ;
47
47
transition ?: Object ;
48
- transitionInjected ?: boolean ; // marker for transition insert hook injection
49
48
show ?: boolean ; // marker for v-show
50
49
inlineTemplate ?: {
51
50
render : Function ;
Original file line number Diff line number Diff line change @@ -63,9 +63,13 @@ export function getFirstComponentChild (children: ?Array<any>) {
63
63
export function mergeVNodeHook ( def : Object , key : string , hook : Function ) {
64
64
const oldHook = def [ key ]
65
65
if ( oldHook ) {
66
- def [ key ] = function ( ) {
67
- oldHook . apply ( this , arguments )
68
- hook . apply ( this , arguments )
66
+ const injectedHash = def . __injected || ( def . __injected = { } )
67
+ if ( ! injectedHash [ key ] ) {
68
+ injectedHash [ key ] = true
69
+ def [ key ] = function ( ) {
70
+ oldHook . apply ( this , arguments )
71
+ hook . apply ( this , arguments )
72
+ }
69
73
}
70
74
} else {
71
75
def [ key ] = hook
Original file line number Diff line number Diff line change @@ -94,21 +94,14 @@ export function enter (vnode: VNodeWithData) {
94
94
95
95
if ( ! vnode . data . show ) {
96
96
// remove pending leave element on enter by injecting an insert hook
97
- var hooks = vnode . data . hook || ( vnode . data . hook = { } )
98
- hooks . _transitionInsert = ( ) => {
97
+ mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'insert' , ( ) => {
99
98
const parent = el . parentNode
100
99
const pendingNode = parent && parent . _pending && parent . _pending [ vnode . key ]
101
100
if ( pendingNode && pendingNode . tag === vnode . tag && pendingNode . elm . _leaveCb ) {
102
101
pendingNode . elm . _leaveCb ( )
103
102
}
104
103
enterHook && enterHook ( el , cb )
105
- }
106
- if ( ! vnode . data . transitionInjected ) {
107
- vnode . data . transitionInjected = true
108
- mergeVNodeHook ( hooks , 'insert' , ( ) => {
109
- hooks . _transitionInsert ( )
110
- } )
111
- }
104
+ } )
112
105
}
113
106
114
107
// start enter transition
You can’t perform that action at this time.
0 commit comments