This looks great, Paul. Can you make a ticket and patch for this? :-)<br>Erik<br><br><div class="gmail_quote">On Wed, Feb 4, 2009 at 15:41, Paul Dziemiela <span dir="ltr"><<a href="mailto:paul@dziemiela.com">paul@dziemiela.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
In some cases I need to "clear the decks" of popups and would like to simply<br>
blast away with the destroy() function anywhere that feature.popup is not<br>
null. However, when I try this against features that haven't actually<br>
created a popup I get several errors. 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>
destroy: function() {<br>
this.imageSrc = null;<br>
this.imageSize = null;<br>
this.isAlphaImage = null;<br>
<br>
this.fixedRelativePosition = false;<br>
this.positionBlocks = null;<br>
<br>
//remove our blocks<br>
// Added this test<br>
if (this.blocks != null) {<br>
for(var i = 0; i < this.blocks.length; i++) {<br>
var block = this.blocks[i];<br>
<br>
if (block.image) {<br>
block.div.removeChild(block.image);<br>
}<br>
block.image = null;<br>
<br>
if (block.div) {<br>
this.groupDiv.removeChild(block.div);<br>
}<br>
block.div = null;<br>
}<br>
}<br>
this.blocks = null;<br>
<br>
OpenLayers.Popup.Anchored.prototype.destroy.apply(this, arguments);<br>
},<br>
<br>
And the following changes to destroy() in Popup.js<br>
<br>
destroy: function() {<br>
<br>
<a href="http://this.id" target="_blank">this.id</a> = null;<br>
this.lonlat = null;<br>
this.size = null;<br>
this.contentHTML = null;<br>
<br>
this.backgroundColor = null;<br>
this.opacity = null;<br>
this.border = null;<br>
<br>
if (this.events != null) {<br>
this.events.destroy();<br>
}<br>
this.events = null;<br>
<br>
if (this.closeDiv != null) {<br>
OpenLayers.Event.stopObservingElement(this.closeDiv);<br>
this.groupDiv.removeChild(this.closeDiv);<br>
}<br>
this.closeDiv = null;<br>
<br>
if (this.div != null) {<br>
this.div.removeChild(this.groupDiv);<br>
}<br>
this.groupDiv = null;<br>
<br>
if (this.map != null) {<br>
this.map.removePopup(this);<br>
}<br>
this.map = null;<br>
this.div = null;<br>
<br>
this.autoSize = null;<br>
this.minSize = null;<br>
this.maxSize = null;<br>
this.padding = null;<br>
this.panMapIfOutOfView = null;<br>
},<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><br>
</blockquote></div><br>