@@ -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 {
@@ -604,8 +603,7 @@ function diffElementNodes(
604603 // Remove children that are not part of any vnode.
605604 if ( excessDomChildren != NULL ) {
606605 for ( i = excessDomChildren . length ; i -- ; ) {
607- const child = excessDomChildren [ i ] ;
608- if ( child ) child . remove ( ) ;
606+ removeNode ( excessDomChildren [ i ] ) ;
609607 }
610608 }
611609 }
@@ -704,8 +702,8 @@ export function unmount(vnode, parentVNode, skipRemove) {
704702 }
705703 }
706704
707- if ( ! skipRemove && vnode . _dom != null && vnode . _dom . parentNode ) {
708- vnode . _dom . remove ( ) ;
705+ if ( ! skipRemove ) {
706+ removeNode ( vnode . _dom ) ;
709707 }
710708
711709 vnode . _component = vnode . _parent = vnode . _dom = UNDEFINED ;
0 commit comments