Merge pull request #843 from ahocevar/early-loadend

Safeguard against listeners that recreate the grid. r=@bartvde
This commit is contained in:
ahocevar
2013-01-17 07:30:22 -08:00

View File

@@ -1104,8 +1104,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
//if that was the last tile, then trigger a 'loadend' on the layer
if (this.numLoadingTiles === 0) {
this.loading = false;
this.events.triggerEvent("loadend");
if(this.backBuffer) {
this._transitionElement = tile.imgDiv;
for (var i=this.transitionendEvents.length-1; i>=0; --i) {
@@ -1119,6 +1117,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this._removeBackBuffer, this.removeBackBufferDelay
);
}
this.loading = false;
this.events.triggerEvent("loadend");
}
};