Re: [SVGMobile12] Question on details of when <script> elements execute

Hello www-svg,

Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Doug Schepers wrote:
> 
>> Scripting logic associated with a given script event must not be raised,
> 
> Er... this seems to have lost a large chunk.  I _think_ what Andre initially 
> sent is more like (trying to disentangle the URIs):
> 
 >> Scripting logic associated with a given script element is made available for
 >> execution when the element is added to the DOM tree. Removing or altering a
 >> script element after the script-content is in the scripting context and
 >> available for execution will not prevent the script from executing nor the
 >> associated load event from being raised. Removing or altering a script element
 >> before the script-content is in the scripting context will prevent the script
 >> from executing, the script-content will not be added to the scripting context
 >> and the associated load event will not be raised. Altering the xlink:href on a
 >> script element in the DOM tree has no effect; loading of the referenced
 >> resource is not required, it must not be added to the scripting context and a 
 >> load event must not be raised, even if the initial script-content had not been
 >> made fully available for execution. This processing model is valid for both
 >> elements which are created through loading a document fragment and for
 >> elements added using DOM methods."
> 
> Which sounds pretty good to me.  The only remaining concern I have is that it's 
> not clear whether "Removing or altering a script element before the 
> script-content is in the scripting context will prevent the script from 
> executing" means it will prevent it, period, or just for now.

Just for now. It did not complete loading, so, did not get added to the
DOM tree, so per the first sentence it didn't get added to the scripting
context.

If, later, you add back the same script element content (in a new script
element,or by altering  the href on an existing one) and if, this time,
it does load then it will get added to the scripting context (again,per
the first sentence).

Not loading is a transitory phenomenon. It does not blacklist that
script content for all time (or document lifetime).

>  For example, if I 
> insert a script into the document, then remove it before the script-content is 
> in the scripting context, then reinsert it later,

and assuming it completely loads this time

>  will it start getting the 
> script-content again and execute it?

Yes.

>  Or no?  The intent sounds like "no" to me
> (or at least that's what I'd expect based on HTML UA experience), but that's not 
> clear from the spec. The clause about a script only executing once doesn't cover 
> this, since the script is not in fact executing.

The first time, its not executing. The second time, it is. (A third
time, it would not because it only executes once).

> Other than this minor nit, this looks great.  Thank you!

Thanks for pointing out your remaining concern so we could address it.

-- 
 Chris Lilley                    mailto:chris@w3.org
 Interaction Domain Leader
 Co-Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG

Received on Saturday, 5 August 2006 20:21:04 UTC