Making it safe to destroy a permalink.
Previously, a map could not be destroyed if it included a permalink control without an "element". In addition, a permalink control could not be destroyed if it didn't have a reference to a map.
This commit is contained in:
@@ -94,12 +94,13 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.element.parentNode == this.div) {
|
||||
if (this.element && this.element.parentNode == this.div) {
|
||||
this.div.removeChild(this.element);
|
||||
this.element = null;
|
||||
}
|
||||
if (this.map) {
|
||||
this.map.events.unregister('moveend', this, this.updateLink);
|
||||
}
|
||||
this.element = null;
|
||||
|
||||
this.map.events.unregister('moveend', this, this.updateLink);
|
||||
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user