always use "parser-inserted scripts" for guaranteed execution order, thanks a lot hsivonen for reporting this and the thorough explanations, r=pgiraud (closes #2933)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11036 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -314,28 +314,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(""));
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user