[Pkg-javascript-commits] [leaflet] 07/40: correctly remove event listener for layer control

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:33:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit 59a8c00a1850103f4fba8561961282eb21b29e7d
Author: Florian Rampp <Florian.Rampp at gmail.com>
Date:   Fri Mar 21 13:48:45 2014 +0100

    correctly remove event listener for layer control
    
    The context (```this```) is passed when registering event listeners for events ```layeradd/layerremove``` and thus also needs to be passed when removing them.
---
 src/control/Control.Layers.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/control/Control.Layers.js b/src/control/Control.Layers.js
index 6fc2cbc..662a6ff 100644
--- a/src/control/Control.Layers.js
+++ b/src/control/Control.Layers.js
@@ -38,8 +38,8 @@ L.Control.Layers = L.Control.extend({
 
 	onRemove: function (map) {
 		map
-		    .off('layeradd', this._onLayerChange)
-		    .off('layerremove', this._onLayerChange);
+		    .off('layeradd', this._onLayerChange, this)
+		    .off('layerremove', this._onLayerChange, this);
 	},
 
 	addBaseLayer: function (layer, name) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list