Does removeChild really delete the element?

后端 未结 4 1598
深忆病人
深忆病人 2020-12-16 18:13

Does removeChild function really delete the child node completely? Or it just removes the element being child of the specified parant node? If it doesn\'t reall

4条回答
  •  囚心锁ツ
    2020-12-16 18:29

    removeChild removes the element from the dom, but it's also returned from the function in case you're doing the removal to re-insert it elsewhere. You'd have to kill that return value to really get rid of the removed node:

    oldNode = someNode.removeChild(...);
    oldNode = null;
    

提交回复
热议问题