Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

document.deleteElement()?

For some reason, I create a temporal HTML element using document.createElement(). The element is not appended to the document tree. I make a new element every mousemove(). Does that allocate any type of memory that I need to deallocate when I am done with the element? How?

like image 485
Mohsin Avatar asked May 08 '14 17:05

Mohsin


1 Answers

If you don't add the element to the DOM or keep any other references to it, they will be freed by the garbage collector. There's no need to manually destroy them.

like image 125
Matti Virkkunen Avatar answered Oct 05 '22 23:10

Matti Virkkunen