I attach objects to html elements like this:
this.div = div;
div.obj = this;
and that circular reference is obviously memory leak risk. If the div is deleted
by overwriting its parent's innerHTML, do the objects get garbage-collected?
to confirm object deletion.)
One way to eliminate the circular reference is to avoid one of the references, probably
"this.div = div," but that could require searching large portions of the document to find
the div when it's needed. I don't want to burden the application that way if it's not
I have not been able to find online wisdom about this (or possibly I've found but not
recognized the answer). Can someone enlighten or reassure me?