From bc6786e0cef832cd444f076093aaaeca30bc1162 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Wed, 28 Mar 2007 22:46:50 +0000 Subject: [PATCH] Remove event listeners on image div in Tile.Image.destroy(). Fixes #576. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2917 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Tile/Image.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 1ba3c94b88..f204f9af9e 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -32,9 +32,12 @@ OpenLayers.Tile.Image.prototype = * */ destroy: function() { - if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) { - this.layer.div.removeChild(this.imgDiv); - this.imgDiv.map = null; + if (this.imgDiv != null) { + OpenLayers.Event.stopObservingElement(this.imgDiv.id); + if (this.imgDiv.parentNode == this.layer.div) { + this.layer.div.removeChild(this.imgDiv); + this.imgDiv.map = null; + } } this.imgDiv = null; OpenLayers.Tile.prototype.destroy.apply(this, arguments);