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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user