- From: Ernest Cline <ernestcline@mindspring.com>
- Date: Sun, 7 Mar 2004 20:48:21 -0500
- To: "Victor Kapustin" <vak@mail.nw.ru>, www-html@w3.org
> [Original Message] > From: Victor Kapustin <vak@mail.nw.ru> > > > The current working draft [1] is that of 6 May 2003 and the text has > > changed considerably for this part [2] of the module. > > Even the current text doesn't touch the issue of scripts that could modify > themselves. Rule 1 of "16.2.1. Rules for processing scripts" states that > "The user agent must first try to process the script element". Suppose > that script removes itself from the DOM tree (say, for the purpose of > modifying itself and reinserting it back as another node). Or it inserts > a hundred of other scripts into the DOM before and after each other. > > Should it be permitted at any time while loading a document? Or just on > successful load? Or no dynamic manipulation of scripts should be > permissible? > > Current browsers (I tried IE 6.1 and Mozilla) allow such manipulations, but > with unpredictable results (probably, because all linked resources - > including scripts - are loaded as separate streams). Well, first off, for XML documents, which also includes XHTML, the entire document including gets parsed and loaded before any scripts are run, so if I am understanding this correctly, no scripts should be running before the document finishes loading. (Note: This is not the case for HTML) Also, if I understand the XHTML2/ XMLEvents model correctly., each script is self-contained so that the creation, deletion, or editing of other <script> elements should have no effect upon the script itself. The only fly in the ointment is what if the script tries to modify the node which contains the script? However ,since that would affect other specifications as well, that would seem to be an issue for XML Events, not for XHTML 2. However the appropriate list for discussing XML Events is... ...............drum roll.................. ...this list. It would be fairly simple to prohibit. Simply require that a node containing a script would be temporarily made read only while the script was executing and thus ban self-modifying scripts. There isn't really any function of self-modifying code that cannot be achieved via non-self-modifying code, so there would be no loss of function, altho sometimes the use of self-modifying code does simplify things. On the other hand, self-modifying code is implementable, with the original script being kept until it finishes execution, but that would leave phantom nodes inaccessible via the DOM and which could greatly complicate an implementation.
Received on Sunday, 7 March 2004 20:48:30 UTC