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:
@@ -362,6 +362,7 @@ OpenLayers.Util.onImageLoad = function() {
|
|||||||
(this.map && this.viewRequestID == this.map.viewRequestID)) {
|
(this.map && this.viewRequestID == this.map.viewRequestID)) {
|
||||||
this.style.display = "";
|
this.style.display = "";
|
||||||
}
|
}
|
||||||
|
OpenLayers.Element.removeClass(this, "olImageLoadError");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+6
-1
@@ -203,13 +203,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Util_imageLoadError(t) {
|
function test_Util_imageLoadError(t) {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
|
|
||||||
var img = OpenLayers.Util.createImage(null, null, null, null, null, null, null, false);
|
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;
|
img._attempts = OpenLayers.IMAGE_RELOAD_ATTEMPTS + 1;
|
||||||
OpenLayers.Util.onImageLoadError.call(img);
|
OpenLayers.Util.onImageLoadError.call(img);
|
||||||
t.ok(OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'broken image has class olImageLoadError');
|
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) {
|
function test_Util_applyDefaults(t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user