var domElementReference = $(document.createElement('div'));
Will the DOM element get destroyed if I don't actually insert it on the page (once domElementReference
gets out of scope)?
If not: If I have a constructor-function that creates DOM elements, is there an automatic way to clear them in javascript?
What I tought was to append them on an element, and then use
myChildNode.parentNode.removeChild(myChildNode);
But than again I have to manually call the function when the object is getting out of scope, and it kind of messes up the whole 'garbage-collection' idea. Any patterns to automatically destroy the object?