diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index ac6151139e..17afdfff3b 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -272,7 +272,10 @@ OpenLayers.Events.prototype = { evt.element = this.element; // execute all callbacks registered for specified type - var listeners = this.listeners[type]; + // get a clone of the listeners array to + // allow for splicing during callbacks + var listeners = (this.listeners[type]) ? + this.listeners[type].slice() : null; if ((listeners != null) && (listeners.length > 0)) { for (var i = 0; i < listeners.length; i++) { var callback = listeners[i];