Fix adding and immediately removing a Layer from the map when the map is never initialized
This commit is contained in:
parent
064902665e
commit
2396a10282
@ -376,6 +376,12 @@ describe("Map", function () {
|
||||
map.removeLayer(layer);
|
||||
});
|
||||
|
||||
it("supports adding and removing a tile layer without initializing the map", function () {
|
||||
var layer = L.tileLayer("{z}{x}{y}");
|
||||
map.addLayer(layer);
|
||||
map.removeLayer(layer);
|
||||
});
|
||||
|
||||
describe("when the last tile layer on a map is removed", function () {
|
||||
it("fires a zoomlevelschange event", function () {
|
||||
map.whenReady(function () {
|
||||
|
@ -56,8 +56,8 @@ L.Layer = L.Evented.extend({
|
||||
this.onRemove(map);
|
||||
}
|
||||
|
||||
if (this.getAttribution && this._map.attributionControl) {
|
||||
this._map.attributionControl.removeAttribution(this.getAttribution());
|
||||
if (this.getAttribution && map.attributionControl) {
|
||||
map.attributionControl.removeAttribution(this.getAttribution());
|
||||
}
|
||||
|
||||
if (this.getEvents) {
|
||||
|
Loading…
Reference in New Issue
Block a user