From 579a429c3b79e5f2ae4723c33b25d5484bf6d4a8 Mon Sep 17 00:00:00 2001 From: "Adam J. Gamble" Date: Tue, 28 Jan 2014 17:20:08 +0000 Subject: [PATCH] change unload order --- src/map/Map.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/map/Map.js b/src/map/Map.js index 4ae2101d..00cdfc15 100644 --- a/src/map/Map.js +++ b/src/map/Map.js @@ -205,9 +205,6 @@ L.Map = L.Evented.extend({ }, remove: function () { - if (this._loaded) { - this.fire('unload'); - } this._initEvents('off'); @@ -225,6 +222,10 @@ L.Map = L.Evented.extend({ } this._clearHandlers(); + + if (this._loaded) { + this.fire('unload'); + } return this; },