<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Here you go.&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I am rather uncertain how you all work together so pardon my
blundering about.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><a href="http://trac.openlayers.org/ticket/1928">http://trac.openlayers.org/ticket/1928</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Cheers and Thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Paul<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Erik Uzureau
[mailto:euzuro@gmail.com] <br>
<b>Sent:</b> Wednesday, February 04, 2009 7:02 PM<br>
<b>To:</b> Paul Dziemiela<br>
<b>Cc:</b> dev &gt;&gt; openlayers<br>
<b>Subject:</b> Re: [OpenLayers-Dev] Destroying popups with abandon<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>This looks great, Paul. Can you
make a ticket and patch for this? :-)<br>
Erik<o:p></o:p></p>

<div>

<p class=MsoNormal>On Wed, Feb 4, 2009 at 15:41, Paul Dziemiela &lt;<a
href="mailto:paul@dziemiela.com">paul@dziemiela.com</a>&gt; wrote:<o:p></o:p></p>

<p class=MsoNormal>Hello,<br>
<br>
In some cases I need to &quot;clear the decks&quot; of popups and would like to
simply<br>
blast away with the destroy() function anywhere that feature.popup is not<br>
null. &nbsp;However, when I try this against features that haven't actually<br>
created a popup I get several errors. &nbsp;Is it reasonable to expect
destroy()<br>
to execute in any case without errors?<br>
<br>
The following changes would be needed to destroy() in Framed.js<br>
<br>
&nbsp; &nbsp;destroy: function() {<br>
&nbsp; &nbsp; &nbsp; this.imageSrc = null;<br>
&nbsp; &nbsp; &nbsp; this.imageSize = null;<br>
&nbsp; &nbsp; &nbsp; this.isAlphaImage = null;<br>
<br>
&nbsp; &nbsp; &nbsp; this.fixedRelativePosition = false;<br>
&nbsp; &nbsp; &nbsp; this.positionBlocks = null;<br>
<br>
&nbsp; &nbsp; &nbsp; //remove our blocks<br>
&nbsp; &nbsp; &nbsp; // Added this test<br>
&nbsp; &nbsp; &nbsp; if (this.blocks != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(var i = 0; i &lt; this.blocks.length;
i++) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var block = this.blocks[i];<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (block.image) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;block.div.removeChild(block.image);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; block.image = null;<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (block.div) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;this.groupDiv.removeChild(block.div);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; block.div = null;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; this.blocks = null;<br>
<br>
&nbsp; &nbsp; &nbsp; OpenLayers.Popup.Anchored.prototype.destroy.apply(this,
arguments);<br>
&nbsp; &nbsp;},<br>
<br>
And the following changes to destroy() in Popup.js<br>
<br>
&nbsp; &nbsp;destroy: function() {<br>
<br>
&nbsp; &nbsp; &nbsp; <a href="http://this.id" target="_blank">this.id</a> =
null;<br>
&nbsp; &nbsp; &nbsp; this.lonlat = null;<br>
&nbsp; &nbsp; &nbsp; this.size = null;<br>
&nbsp; &nbsp; &nbsp; this.contentHTML = null;<br>
<br>
&nbsp; &nbsp; &nbsp; this.backgroundColor = null;<br>
&nbsp; &nbsp; &nbsp; this.opacity = null;<br>
&nbsp; &nbsp; &nbsp; this.border = null;<br>
<br>
&nbsp; &nbsp; &nbsp; if (this.events != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.events.destroy();<br>
&nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; this.events = null;<br>
<br>
&nbsp; &nbsp; &nbsp; if (this.closeDiv != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;OpenLayers.Event.stopObservingElement(this.closeDiv);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.groupDiv.removeChild(this.closeDiv);<br>
&nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; this.closeDiv = null;<br>
<br>
&nbsp; &nbsp; &nbsp; if (this.div != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.div.removeChild(this.groupDiv);<br>
&nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; this.groupDiv = null;<br>
<br>
&nbsp; &nbsp; &nbsp; if (this.map != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.map.removePopup(this);<br>
&nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; this.map = null;<br>
&nbsp; &nbsp; &nbsp; this.div = null;<br>
<br>
&nbsp; &nbsp; &nbsp; this.autoSize = null;<br>
&nbsp; &nbsp; &nbsp; this.minSize = null;<br>
&nbsp; &nbsp; &nbsp; this.maxSize = null;<br>
&nbsp; &nbsp; &nbsp; this.padding = null;<br>
&nbsp; &nbsp; &nbsp; this.panMapIfOutOfView = null;<br>
&nbsp; &nbsp;},<br>
<br>
Thanks!<br>
<br>
Paul<br>
<br>
<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><o:p></o:p></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>