Hi all,
> > It's a good idea, and probably it will work: I'll make some test,
> > but if I remember the innerHTML property
> > is not part of the DOM specification, so I'm not sure using it is
> > a much better habit than using document.write().
> Yes, it is not part of the specifications. But it is support by every
> modern browser I think. It is a bad habit - sure - but if it works,
> it would be the simplest solution.
The 5th edition of "Javascript - The Definitive Guide" by Flanagan (just published) says (p336):
"Although it has never been sanctioned by the W3C as an official part
of the DOM, the innerHTML property of HTMLElement nodes is an
important and powerful property that is supported by all modern
browsers.
....
Web browsers are, almost by definition, very good at parsing HTML. It
turns out that using innerHTML is a reasonably efficient thing to do,
especially when working with large chunks of HTML text to be parsed.
Note, however that appending bits of text to the innerHTML property
with the += operator is usually not efficient because it requires
both a serialization step and a parsing step."
It might be the *best* solution :-)
thank you all for your suggestions, I made several test and
unfortunately it doesn't work; here
are the results:
- Appending <script> tags to <head> (where the inclusion of
script/custom.js is usually placed) does not
work neither in IE6, nor in FF nor in Opera: the <script> tags get
added, the script sources get requested
from the web server but it seems they are not parsed.
- Inserting a <div> tag into <head> and adding <script> tags inside it
does work in FF but neither in Opera nor
in IE6, as above. As a side note, even if this worked in all browsers,
it wouldn't produce a valid XHTML
document, since its DTD only allows script, style, meta, link, object,
base and title elements inside head elements.
- I moved the inclusion of script/custom.js to <body> and appended
<script>s to <body> or to <head> with or
without enclosing them in divs but the results were always the same as
above.
It seems that adding script tags while the document is being loaded is a
tough problem for all browsers: all in all
the DOM appendChild() + XHTMLRequest workaround for IE6 problems seems
the most standards-compliant
and practical solution at the moment even if it's not the most efficient.
Any other ideas?
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