mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-23 00:34:55 +00:00
Explicitly remove controls from the map on map unload (#6488)
This commit is contained in:

committed by
GitHub

parent
82e850fce1
commit
61ef1776ac
@ -79,6 +79,8 @@ export var Control = Class.extend({
|
||||
corner.appendChild(container);
|
||||
}
|
||||
|
||||
this._map.on('unload', this.remove, this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
@ -95,6 +97,7 @@ export var Control = Class.extend({
|
||||
this.onRemove(this._map);
|
||||
}
|
||||
|
||||
this._map.off('unload', this.remove, this);
|
||||
this._map = null;
|
||||
|
||||
return this;
|
||||
|
Reference in New Issue
Block a user