From 44ba385429565963419eca661958de4ebb7e3a5c Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 8 Jan 2010 21:14:04 +0000 Subject: [PATCH] Removing any onImageLoadError class name from images when they successfully load. r=ahocevar (closes #2407) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9940 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 1 + tests/Util.html | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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) {