[OpenLayers-Commits] r12245 - trunk/openlayers/lib/OpenLayers/Tile

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Sun Aug 14 10:33:02 EDT 2011


Author: ahocevar
Date: 2011-08-14 07:33:00 -0700 (Sun, 14 Aug 2011)
New Revision: 12245

Modified:
   trunk/openlayers/lib/OpenLayers/Tile/Image.js
Log:
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)

Modified: trunk/openlayers/lib/OpenLayers/Tile/Image.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Tile/Image.js	2011-08-13 09:17:24 UTC (rev 12244)
+++ trunk/openlayers/lib/OpenLayers/Tile/Image.js	2011-08-14 14:33:00 UTC (rev 12245)
@@ -274,9 +274,19 @@
      * 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;
         }
     },
     



More information about the Commits mailing list