Ciao Sebastian,
> The reason I didn't replace document.write() entirely is that while
> testing I found that
> adding script elements using DOM methods doesn't work reliably in IE 6:
> the script nodes
> gets added, but it seems they are parsed in the wrong order (or not at
> all): the result is that while
> loading you get several errors and the application doesn't work: because
> of this the includer first tries
> document.write() and only if it fails it switches to using DOM.
Maybe it does help to insert the scripts inside a parent first. E.g. put
all script elements in a div element first. And after all these children
are inside add this div to the document itself.
This does not help. I also tried using a DocumentFragment node as a
container, but the result was always the same: it seems to me that IE 6
is sort-of asynchronous when loading the javascript source of the script
nodes added by DOM methods; when the appendChild() method returns, the
source is not guaranteed to be fully loaded, and this explains the
problems I mentioned above.
To further support this theory there is the fact that if you insert an
alert() after adding every node, all scripts load fine and without
errors.
So the problem seems how to guarantee that a script node is fully loaded
before adding the following one.
Given this, and reading your suggestion about XMLHttpRequest, the first
approach I tried was to read the script source using a synchronous
XMLHttpRequest and then adding the script node with its text property
set to the request's responseText. This works but makes debugging
difficult since all scripts get merged into one very big document.
So I tried a different approach: I used the synchronous XMLHttpRequest
to force the browser to read the script source in its entirety, then I
appendChild()ed the script node with the same source: since the script
source is already into the browser cache it is parsed immediately and
all works fine. This way I finally got rid of document.write().
I tested this solution with Opera 9, IE 6, FireFox 1.5.0.6 & 2.0RC3 and
all worked without problems.
If you agree with this approach, I can commit the change to SVN this
evening.
Alessandro
begin:vcard
fn:Alessandro Sala
n:Sala;Alessandro
email;internet:alessandro {dot} sala {at} mclink {dot} net
version:2.1
end:vcard
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel