From 474064b4e5b7b040571752cf0091623bcb1a3cdd Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 31 Mar 2007 19:47:05 +0000 Subject: [PATCH] Clean up all events, not just some of them. Cleans up possible memory leaks. Closes #604, patch by Erik. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2947 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Events.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 1d269577bf..1e752b39ba 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -279,7 +279,7 @@ OpenLayers.Events.prototype = { */ destroy: function () { if (this.element) { - this.detachFromElement(); + OpenLayers.Event.stopObservingElement(this.element); } this.element = null; @@ -308,22 +308,6 @@ OpenLayers.Events.prototype = { // disable dragstart in IE so that mousedown/move/up works normally OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop); }, - - /** - * @private - */ - detachFromElement: function () { - for (var i = 0; i < this.BROWSER_EVENTS.length; i++) { - var eventType = this.BROWSER_EVENTS[i]; - - OpenLayers.Event.stopObserving( - this.element, eventType, this.eventHandler); - } - - // re-enable dragstart in IE - OpenLayers.Event.stopObserving( - this.element, "dragstart", OpenLayers.Event.stop); - }, /** * @param {String} type Name of the event to register