diff --git a/lib/OpenLayers/Control/Permalink.js b/lib/OpenLayers/Control/Permalink.js index 25b3d153a4..0235e719de 100644 --- a/lib/OpenLayers/Control/Permalink.js +++ b/lib/OpenLayers/Control/Permalink.js @@ -32,6 +32,20 @@ OpenLayers.Control.Permalink.prototype = } }, + /** + * + */ + destroy: function() { + if (this.element.parentNode == this.div) { + this.div.removeChild(this.element); + } + this.element = null; + + this.map.events.unregister('moveend', this, this.updateLink); + + OpenLayers.Control.prototype.destroy.apply(this, arguments); + }, + /** Set the map property for the control. * * @param {OpenLayers.Map} map