Element is not being removed from DOM when remove() on parent element is called when holding an instance in another class
<p>I have a jquery extended class (Class2) which is initialized by another jquery extended class (Class1). </p>

<p>Class1 adds a div container element to the DOM, and initializes Class2. Class2 takes an argument which is the div container element from Class1 and adds a child to that container.</p>

<p>As discussed in this thread <a href="http://stackoverflow.com/questions/8152438/eventmanager-that-calls-other-objects-functions">Eventmanager that calls other objects&#39; functions</a>, an manager holds a pointer to an instance of Class2. </p>

<p>In Class1 I call remove() on the container element and want all child elements to also be removed completely. But when I create a new instance of Class2 and it adds a child element again, then I have two child elements. If I do this over and over again I get one child element (which is added one time by Class2) more each time. </p>

<p>This is caused by that I hold an instance of Class2 in the manager. So I'm looking for a solution to remove the instance from the manager when elements that Class2 knows about is being removed. I know how to do this manually, but I want to see if this can be done somewhat magically by using events or something like that.</p>

<p>The manager holds an instance in order to call functions in different instances.
The solution need to work cross-browser, and at least IE8.</p>

<p>Thanks in advance!</p>
