I am not sure that someone else has reported this, but I have not found it
in the list (at least not on a fast look).
I am writing an application that request to load dynamically some js files,
including also the base.js o3d file and other from o3d. The problem is that
the "require" method (function) used by o3d is deleting the old existing
script elements from the HTML head and add only the one that you are
requesting via "require" mechanism from od3.
What steps will reproduce the problem?
1. Use the o3d js library but import it in a dynamic way, and not
statically in the HTML head when write the HTML file.
2. Run the script/file/html.
3. Observe (using firebug or something else) the head part of the document.
What is the expected output? What do you see instead?
Old existing + currently added <script> are dropped from the head and only
the o3d ones (requested using the "require" mechanism) are now there (in
the HTML head).
What version of the product are you using? On what operating system?
Linux/windows: FF 3.5.3/ IE8
What hardware are you using: graphics card type? motherboard type?
Not important.
Please provide any additional information below.
This is the NOT working code from O3D (file: base.js):
o3djs.writeScriptTag_ = function(src) {
var doc = o3djs.global.document;
if (typeof doc != 'undefined' &&
!o3djs.dependencies_.written[src]) {
o3djs.dependencies_.written[src] = true;
doc.write('<script type="text/javascript" src="' +
src + '"></' + 'script>');
}
};
This is the modified one that works (at least in my case):
o3djs.writeScriptTag_ = function(src) {
var doc = o3djs.global.document;
if (typeof doc != 'undefined' &&
!o3djs.dependencies_.written[src]) {
o3djs.dependencies_.written[src] = true;
var theScript = doc.createElement("script");
theScript.type = "text/javascript";
theScript.src = src;
doc.getElementsByTagName("head")[0].appendChild(theScript);
}
};
Original issue reported on code.google.com by dimir...@gmail.com on 22 Oct 2009 at 4:26
Original issue reported on code.google.com by
dimir...@gmail.com
on 22 Oct 2009 at 4:26