[OpenLayers-Users] OpenLayers.js xhtml patch
Steve Pomeroy
spomeroy at ftrd.us
Wed Aug 9 14:52:10 CDT 2006
There was a stray document.write() (instead of DOM manipulation) in OpenLayers.js that
caused it to not work when in Firefox's actual application/xhtml+xml mode.
(examples/xhtml.html isn't treated as actual xhtml by Firefox unless it's renamed to
.xhtml). The patch below does the appropriate DOM twiddling:
Index: lib/OpenLayers.js
===================================================================
--- lib/OpenLayers.js (revision 1170)
+++ lib/OpenLayers.js (working copy)
@@ -104,9 +104,11 @@
catch (e) { start=0; }
for (var i = start; i < jsfiles.length; i++) {
- var currentScriptTag = "<script src='" + host + jsfiles[i] + "'></script>";
- allScriptTags += currentScriptTag;
+ var currentScriptElem = document.createElement('script');
+ currentScriptElem.type = 'text/javascript';
+ currentScriptElem.src = host + jsfiles[i];
+
+ document.getElementsByTagName("head")[0].appendChild(currentScriptElem);
}
- document.write(allScriptTags);
})();
}
More information about the Users
mailing list