diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 7819fe3396..a8c1912730 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -285,6 +285,15 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { */ rowSign: null, + /** + * Property: transitionendEvents + * {Array} Event names for transitionend + */ + transitionendEvents: [ + 'transitionend', 'webkitTransitionEnd', 'otransitionend', + 'oTransitionEnd' + ], + /** * Constructor: OpenLayers.Layer.Grid * Create a new grid layer @@ -759,10 +768,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { */ removeBackBuffer: function() { if (this._transitionElement) { - OpenLayers.Event.stopObserving(this._transitionElement, 'transitionend', this._removeBackBuffer); - OpenLayers.Event.stopObserving(this._transitionElement, 'webkitTransitionEnd', this._removeBackBuffer); - OpenLayers.Event.stopObserving(this._transitionElement, 'otransitionend', this._removeBackBuffer); - OpenLayers.Event.stopObserving(this._transitionElement, 'oTransitionEnd', this._removeBackBuffer); + for (var i=this.transitionendEvents.length-1; i>=0; --i) { + OpenLayers.Event.stopObserving(this._transitionElement, + this.transitionendEvents[i], this._removeBackBuffer); + } delete this._transitionElement; } if(this.backBuffer) { @@ -1129,10 +1138,11 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.events.triggerEvent("loadend"); if(this.backBuffer) { this._transitionElement = tile.imgDiv; - OpenLayers.Event.observe(this._transitionElement, 'transitionend', this._removeBackBuffer); - OpenLayers.Event.observe(this._transitionElement, 'webkitTransitionEnd', this._removeBackBuffer); - OpenLayers.Event.observe(this._transitionElement, 'otransitionend', this._removeBackBuffer); - OpenLayers.Event.observe(this._transitionElement, 'oTransitionEnd', this._removeBackBuffer); + for (var i=this.transitionendEvents.length-1; i>=0; --i) { + OpenLayers.Event.observe(this._transitionElement, + this.transitionendEvents[i], + this._removeBackBuffer); + } // the removal of the back buffer is delayed to prevent // flash effects due to the animation of tile displaying this.backBufferTimerId = window.setTimeout( this._removeBackBuffer, this.removeBackBufferDelay