[OpenLayers-Commits] r12177 - sandbox/camptocamp/geobretagne/lib

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Jul 21 08:54:45 EDT 2011


Author: fvanderbiest
Date: 2011-07-21 05:54:44 -0700 (Thu, 21 Jul 2011)
New Revision: 12177

Modified:
   sandbox/camptocamp/geobretagne/lib/OpenLayers.js
Log:
camptocamp/geobretagne sandbox: applied patch attached to #2933 so that debug mode works again

Modified: sandbox/camptocamp/geobretagne/lib/OpenLayers.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/OpenLayers.js	2011-07-20 20:51:08 UTC (rev 12176)
+++ sandbox/camptocamp/geobretagne/lib/OpenLayers.js	2011-07-21 12:54:44 UTC (rev 12177)
@@ -317,28 +317,15 @@
             "OpenLayers/Lang/en.js"
         ); // etc.
 
-        var agent = navigator.userAgent;
-        var docWrite = (agent.match("MSIE") || agent.match("Safari"));
-        if(docWrite) {
-            var allScriptTags = new Array(jsfiles.length);
-        }
+        // use "parser-inserted scripts" for guaranteed execution order
+        // http://hsivonen.iki.fi/script-execution/
+        var allScriptTags = new Array(jsfiles.length);
         var host = OpenLayers._getScriptLocation() + "lib/";    
         for (var i=0, len=jsfiles.length; i<len; i++) {
-            if (docWrite) {
-                allScriptTags[i] = "<script src='" + host + jsfiles[i] +
+            allScriptTags[i] = "<script src='" + host + jsfiles[i] +
                                    "'></script>"; 
-            } else {
-                var s = document.createElement("script");
-                s.src = host + jsfiles[i];
-                var h = document.getElementsByTagName("head").length ? 
-                           document.getElementsByTagName("head")[0] : 
-                           document.body;
-                h.appendChild(s);
-            }
         }
-        if (docWrite) {
-            document.write(allScriptTags.join(""));
-        }
+        document.write(allScriptTags.join(""));
     }
 })();
 



More information about the Commits mailing list