diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 6260212cc2..40cc3d84ad 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -362,6 +362,7 @@ OpenLayers.Util.onImageLoad = function() { (this.map && this.viewRequestID == this.map.viewRequestID)) { this.style.display = ""; } + OpenLayers.Element.removeClass(this, "olImageLoadError"); }; /** diff --git a/tests/Util.html b/tests/Util.html index 2932f7a376..f1352b2fe7 100644 --- a/tests/Util.html +++ b/tests/Util.html @@ -203,13 +203,18 @@ } function test_Util_imageLoadError(t) { - t.plan(1); + t.plan(2); var img = OpenLayers.Util.createImage(null, null, null, null, null, null, null, false); + // mock up image load failure img._attempts = OpenLayers.IMAGE_RELOAD_ATTEMPTS + 1; OpenLayers.Util.onImageLoadError.call(img); t.ok(OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'broken image has class olImageLoadError'); + + // mock up image load success + OpenLayers.Util.onImageLoad.call(img); + t.ok(!OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'good image does not have class olImageLoadError'); } function test_Util_applyDefaults(t) {