根据mdn 文档,该方法removeChild
从 DOM 中删除了一个节点,但它仍然驻留在内存中。我的问题是我也想从内存中删除它。我已经尝试过delete
操作员,但对象仍然存在......
myCanvas.parentElement.removeChild(myCanvas); // myCanvas actually removed from DOM
delete myCanvas; // false. does nothing
alert(myCanvas); // shows HTMLCanvasElement instead of undefined