From 1223ea339d8e880277137e878ea5dd54a5a45a05 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 May 2013 09:51:19 +0200 Subject: [PATCH] Use getTile() instead of imgDiv to get the correct element The correct way to get the markup of a tile is to use getTile() - the imgDiv will only be available if the tile does not use a frame. --- lib/OpenLayers/Layer/Grid.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 1187dabb06..a94075f143 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -1100,7 +1100,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.events.triggerEvent("tileloadstart", {tile: tile}); this.numLoadingTiles++; if (!this.singleTile && this.backBuffer && this.gridResolution === this.backBufferResolution) { - OpenLayers.Element.addClass(tile.imgDiv, replacingCls); + OpenLayers.Element.addClass(tile.getTile(), replacingCls); } }; @@ -1112,13 +1112,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { aborted: aborted }); if (!this.singleTile && !aborted && this.backBuffer && this.gridResolution === this.backBufferResolution) { - if (OpenLayers.Element.getStyle(tile.imgDiv, 'display') === 'none') { + var tileDiv = tile.getTile(); + if (OpenLayers.Element.getStyle(tileDiv, 'display') === 'none') { var bufferTile = document.getElementById(tile.id + '_bb'); if (bufferTile) { bufferTile.parentNode.removeChild(bufferTile); } } - OpenLayers.Element.removeClass(tile.imgDiv, replacingCls); + OpenLayers.Element.removeClass(tileDiv, replacingCls); } //if that was the last tile, then trigger a 'loadend' on the layer if (this.numLoadingTiles === 0) {