Peter Sorotokin wrote: > I don't think HTML or XHTML spec really defines it. You're correct, it does not. There's a de-facto standard, not a de-jure one. > If new script needs to be executed at runtime, just execute script > through your language-dependent mechanisms explicitly. I want to dynamically execute the script at http://foo at runtime. Using language-dependent mechanisms in ECMAScript I have to somehow load the data into a string (dealing with character encodings in the process) and then call eval() on it? Using a <script> node, I just set the src attribute and insert the node. This is a relatively common use case on the web, especially for working around UA bugs by executing slightly different scripts based on UA-sniffing or object-sniffing (though most pages use document.write() instead of creating nodes via DOM, the concept is the same and document.write() is not available in SVG). > If script is executed on insertion, a lot of funny issues arise. For instance, if I > remove a branch from a tree and then insert it somewhere else all the > scripts in that branch will be reexecuted Not necessarily. See the algorithm described in my last response to Jim. -BorisReceived on Wednesday, 1 December 2004 17:57:40 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:54:53 GMT