Fixing the issue with loading image placeholders in FF >= 4 that was discussed during the review. I take erilem's final comment as permission to commit this without an additional review (see #3419)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12245 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-08-14 14:33:00 +00:00
parent fd8003464e
commit eabde4f74f

View File

@@ -274,9 +274,19 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile.BackBufferable, {
* url - {String} or undefined to hide the image
*/
setImgSrc: function(url) {
this.imgDiv.style.display = "none";
var img = this.imgDiv;
img.style.display = "none";
// Setting img.src to "about:blank" would cause a broken image icon in
// some browsers, but we only use it when style.display is set to
// "none", so we don't care. We need this to prevent old images or
// loading image placeholders to be shown when the image's display style
// is set to "" in the onImageLoad method, which is called just before
// the image is rendered in some browsers. Note that setting img.src to
// "" would cause a request for the current page location being sent to
// the server in most browsers.
img.src = "about:blank";
if (url) {
this.imgDiv.src = url;
img.src = url;
}
},