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
This commit is contained in:
Tim Schaub
2010-01-08 21:14:04 +00:00
parent 9066c0e960
commit 44ba385429
2 changed files with 7 additions and 1 deletions

View File

@@ -362,6 +362,7 @@ OpenLayers.Util.onImageLoad = function() {
(this.map && this.viewRequestID == this.map.viewRequestID)) {
this.style.display = "";
}
OpenLayers.Element.removeClass(this, "olImageLoadError");
};
/**

View File

@@ -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) {