diff --git a/spec/suites/map/MapSpec.js b/spec/suites/map/MapSpec.js index e66f54aea..fc8c76f2a 100644 --- a/spec/suites/map/MapSpec.js +++ b/spec/suites/map/MapSpec.js @@ -72,7 +72,7 @@ describe("Map", function () { it("does not throw if removed during animation", function () { var container = document.createElement('div'), - map = new L.Map(container).setView([0, 0], 1); + map = new L.Map(container).setView([0, 0], 1).setMaxBounds([[0, 1], [2, 3]]); // Force creation of animation proxy, // otherwise browser checks disable it diff --git a/src/map/Map.js b/src/map/Map.js index 5a66c9a57..0eb1e372c 100644 --- a/src/map/Map.js +++ b/src/map/Map.js @@ -752,6 +752,7 @@ export var Map = Evented.extend({ remove: function () { this._initEvents(true); + this.off('moveend', this._panInsideMaxBounds); if (this._containerId !== this._container._leaflet_id) { throw new Error('Map container is being reused by another instance');