From 6b0808d6f062c7d58e522d89e824ec20ed67ffec Mon Sep 17 00:00:00 2001 From: Babajide Fowotade Date: Fri, 30 Sep 2016 08:28:42 +0100 Subject: [PATCH] Don't load class leaflet-tile-loaded in case of error (#4980) --- src/layer/tile/GridLayer.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js index f3f458a0..e32aca24 100644 --- a/src/layer/tile/GridLayer.js +++ b/src/layer/tile/GridLayer.js @@ -811,14 +811,16 @@ L.GridLayer = L.Layer.extend({ this._pruneTiles(); } - L.DomUtil.addClass(tile.el, 'leaflet-tile-loaded'); + if (!err) { + L.DomUtil.addClass(tile.el, 'leaflet-tile-loaded'); - // @event tileload: TileEvent - // Fired when a tile loads. - this.fire('tileload', { - tile: tile.el, - coords: coords - }); + // @event tileload: TileEvent + // Fired when a tile loads. + this.fire('tileload', { + tile: tile.el, + coords: coords + }); + } if (this._noTilesToLoad()) { this._loading = false;