On 04/09/07, <b class="gmail_sendername">Christopher Schmidt</b> &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Mon, Sep 03, 2007 at 11:20:14AM +1000, Glen Stampoultzis wrote:<br>&gt; On 31/08/07, Christopher Schmidt &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; On Fri, Aug 31, 2007 at 04:12:54PM +1000, Glen Stampoultzis wrote:
<br>&gt; &gt; &gt; Hi...<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; just been mucking around with popups and I noticed that the destroy<br>&gt; &gt; method<br>&gt; &gt; &gt; does seem to get called.&nbsp;&nbsp;The close poup button just hides the div from
<br>&gt; &gt; what<br>&gt; &gt; &gt; I can tell and the map.removePopup() call seems to remove the div from<br>&gt; &gt; the<br>&gt; &gt; &gt; DOM without calling destroy and cleaning up the event handlers.<br>&gt; &gt; &gt;
<br>&gt; &gt; &gt; Bug or feature?<br>&gt; &gt;<br>&gt; &gt; When would you call destroy? Certainly, a popup can be removed from the<br>&gt; &gt; map without it being destroyed: it can be re-added at a later time, and<br>
&gt; &gt; we use that behavior in some applications here at MetaCarta.<br>&gt; &gt;<br>&gt; &gt; In general, removing things is not the same as destroying them, and<br>&gt; &gt; depending on when they are created, you may have to clean up after
<br>&gt; &gt; yourself rather than depending on OpenLayers to do it for you.<br>&gt; &gt;<br>&gt; &gt; If you use a feature to create the popup, it destroys the popup for<br>&gt; &gt; you. If you create your own, you&#39;re on your own.
<br>&gt; &gt;<br>&gt; &gt;<br>&gt; It&#39;s just that popup doesn&#39;t provide any way for you to attach an event<br>&gt; indicating the user has closed the popup using the close button so how do<br>&gt; you know when to destroy?
<br><br>You probably don&#39;t want to destroy when the user closed the popup<br>anyway: It&#39;s still attached to the map at that point, no?<br><br>One possibility is just to destroy it when the window is closed -- but<br>
really, if there&#39;s still any popups on the map when the page is<br>unloaded, we should be destroying them. I&#39;ve opened ticket #955 for<br>that. Would that be enough to solve the problem? Is destroying the<br>popups during your application&#39;s running important?
<br><br></blockquote></div><br>It would help.&nbsp; I guess I&#39;m a bit anal about leaving loads of
unnecessary event handlers registered for popups that aren&#39;t visible.&nbsp;
I can do a check for hidden popups before opening a new one I guess.<br>
<br><br><br>