@@ -13,7 +13,7 @@ import { BaseComponent, getDomSibling } from '../component';
1313import { Fragment } from '../create-element' ;
1414import { diffChildren } from './children' ;
1515import { setProperty } from './props' ;
16- import { assign , isArray , slice } from '../util' ;
16+ import { assign , isArray , removeNode , slice } from '../util' ;
1717import options from '../options' ;
1818
1919/**
@@ -346,8 +346,7 @@ export function diff(
346346 newVNode . _dom = oldDom ;
347347 } else {
348348 for ( let i = excessDomChildren . length ; i -- ; ) {
349- const child = excessDomChildren [ i ] ;
350- if ( child ) child . remove ( ) ;
349+ removeNode ( excessDomChildren [ i ] ) ;
351350 }
352351 }
353352 } else {
@@ -589,8 +588,7 @@ function diffElementNodes(
589588 // Remove children that are not part of any vnode.
590589 if ( excessDomChildren != NULL ) {
591590 for ( i = excessDomChildren . length ; i -- ; ) {
592- const child = excessDomChildren [ i ] ;
593- if ( child ) child . remove ( ) ;
591+ removeNode ( excessDomChildren [ i ] ) ;
594592 }
595593 }
596594 }
@@ -689,8 +687,8 @@ export function unmount(vnode, parentVNode, skipRemove) {
689687 }
690688 }
691689
692- if ( ! skipRemove && vnode . _dom != null && vnode . _dom . parentNode ) {
693- vnode . _dom . remove ( ) ;
690+ if ( ! skipRemove ) {
691+ removeNode ( vnode . _dom ) ;
694692 }
695693
696694 vnode . _component = vnode . _parent = vnode . _dom = UNDEFINED ;
0 commit comments