diff --git a/flow/options.js b/flow/options.js index e4c6ed1f968..2e138a62ab9 100644 --- a/flow/options.js +++ b/flow/options.js @@ -2,8 +2,6 @@ declare type InternalComponentOptions = { _isComponent: true; parent: Component; _parentVnode: VNode; - _parentElm: ?Node; - _refElm: ?Node; render?: Function; staticRenderFns?: Array }; @@ -81,8 +79,6 @@ declare type ComponentOptions = { _componentTag: ?string; _scopeId: ?string; _base: Class; - _parentElm: ?Node; - _refElm: ?Node; }; declare type PropOptions = { diff --git a/src/core/instance/init.js b/src/core/instance/init.js index ed2550d09ae..9b2ec80c44d 100644 --- a/src/core/instance/init.js +++ b/src/core/instance/init.js @@ -77,8 +77,6 @@ export function initInternalComponent (vm: Component, options: InternalComponent const parentVnode = options._parentVnode opts.parent = options.parent opts._parentVnode = parentVnode - opts._parentElm = options._parentElm - opts._refElm = options._refElm const vnodeComponentOptions = parentVnode.componentOptions opts.propsData = vnodeComponentOptions.propsData diff --git a/src/core/instance/lifecycle.js b/src/core/instance/lifecycle.js index c5dc7668b98..5521e03ed35 100644 --- a/src/core/instance/lifecycle.js +++ b/src/core/instance/lifecycle.js @@ -59,14 +59,7 @@ export function lifecycleMixin (Vue: Class) { // based on the rendering backend used. if (!prevVnode) { // initial render - vm.$el = vm.__patch__( - vm.$el, vnode, hydrating, false /* removeOnly */, - vm.$options._parentElm, - vm.$options._refElm - ) - // no need for the ref nodes after initial patch - // this prevents keeping a detached DOM tree in memory (#5851) - vm.$options._parentElm = vm.$options._refElm = null + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */) } else { // updates vm.$el = vm.__patch__(prevVnode, vnode) diff --git a/src/core/vdom/create-component.js b/src/core/vdom/create-component.js index 4062debdd25..f9ba952a2eb 100644 --- a/src/core/vdom/create-component.js +++ b/src/core/vdom/create-component.js @@ -34,12 +34,7 @@ import { // inline hooks to be invoked on component VNodes during patch const componentVNodeHooks = { - init ( - vnode: VNodeWithData, - hydrating: boolean, - parentElm: ?Node, - refElm: ?Node - ): ?boolean { + init (vnode: VNodeWithData, hydrating: boolean): ?boolean { if ( vnode.componentInstance && !vnode.componentInstance._isDestroyed && @@ -51,9 +46,7 @@ const componentVNodeHooks = { } else { const child = vnode.componentInstance = createComponentInstanceForVnode( vnode, - activeInstance, - parentElm, - refElm + activeInstance ) child.$mount(hydrating ? vnode.elm : undefined, hydrating) } @@ -215,15 +208,11 @@ export function createComponent ( export function createComponentInstanceForVnode ( vnode: any, // we know it's MountedComponentVNode but flow doesn't parent: any, // activeInstance in lifecycle state - parentElm?: ?Node, - refElm?: ?Node ): Component { const options: InternalComponentOptions = { _isComponent: true, - parent, _parentVnode: vnode, - _parentElm: parentElm || null, - _refElm: refElm || null + parent } // check inline-template render functions const inlineTemplate = vnode.data.inlineTemplate diff --git a/src/core/vdom/patch.js b/src/core/vdom/patch.js index 9f3bcc6512c..fb28d8cd341 100644 --- a/src/core/vdom/patch.js +++ b/src/core/vdom/patch.js @@ -212,7 +212,7 @@ export function createPatchFunction (backend) { if (isDef(i)) { const isReactivated = isDef(vnode.componentInstance) && i.keepAlive if (isDef(i = i.hook) && isDef(i = i.init)) { - i(vnode, false /* hydrating */, parentElm, refElm) + i(vnode, false /* hydrating */) } // after calling the init hook, if the vnode is a child component // it should've created a child instance and mounted it. the child @@ -220,6 +220,7 @@ export function createPatchFunction (backend) { // in that case we can just return the element and be done. if (isDef(vnode.componentInstance)) { initComponent(vnode, insertedVnodeQueue) + insert(parentElm, vnode.elm, refElm) if (isTrue(isReactivated)) { reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) } @@ -681,7 +682,7 @@ export function createPatchFunction (backend) { } } - return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) { + return function patch (oldVnode, vnode, hydrating, removeOnly) { if (isUndef(vnode)) { if (isDef(oldVnode)) invokeDestroyHook(oldVnode) return @@ -693,7 +694,7 @@ export function createPatchFunction (backend) { if (isUndef(oldVnode)) { // empty mount (likely as component), create new root element isInitialPatch = true - createElm(vnode, insertedVnodeQueue, parentElm, refElm) + createElm(vnode, insertedVnodeQueue) } else { const isRealElement = isDef(oldVnode.nodeType) if (!isRealElement && sameVnode(oldVnode, vnode)) {