When creating a new image element in javascript, the Google Chrome memory tool (developer tools> Timeline> Memory) naturally treats it as a new DOM element.
In my case, I get 1500+ DOM elements, and I want to get rid of them. I tried to save all the objects in an array and delete all of them in a loop when I am ready to create all the objects, which will lead to the following error:
Uncaught TypeError: Cannot call method 'removeChild' of null
This means that image objects are not displayed in the actual DOM.
var images = []; var i, image; for( i = 0; i < urls.length; i++ ) { image = new Image(); image.src = urls[i]; }
Is there any way to delete / delete / delete / delete image objects?
Tim S.
source share