W3C home > Mailing lists > Public > www-svg@w3.org > July 2006

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 24 Jul 2006 11:15:48 -0500
Message-ID: <44C4F234.50807@mit.edu>
To: Andrew Sledd <Andrew.Sledd@ikivo.com>
CC: www-svg@w3.org

Andrew Sledd wrote:
> [Andy]  The load event description is correct. The script execution
> description has also been updated to reflect this.

Thank you.

>> 2)  What happens if the xlink:href is changed before the load 
>> event fires? 
> [Andy] only the original scripts content is executed as per the
> spec. The change to xlink:href will raise an additional load
> event when the external resource is loaded.

That sounds good (especially because it matches the behavior of HTML UAs in 
similar circumstances), but where does the spec say this?  I don't see it in the 
latest draft.

> [Andy] This is meant to answer both 5 and 6; and I hope you agree.
> A script element can be cloned or created and inserted.
> Each time it is inserted it is executed. The clause "Inserting a 
> script element into the DOM tree will cause it to execute." is not 
> limited to new or unexecuted script-content. 

I'm trying to reconcile that last statement with "Any scripting logic associated 
with a given script element is executed at most once.".  I assume that this 
overrides the "is not limited to new or unexecuted script-content" language?  If 
so, this should be explicitly stated.

I just realized that there is a further ambiguity in the spec, if the script 
content to be executed is that for the "original" xlink:href.  Consider the 
following sequence of events:

1)  createElementNS a <script> node.
2)  Set xlink:href to "foo"
3)  Wait for a while (long enough for "foo" to have loaded).
4)  Set xlink:href to "bar"
5)  Insert the node into the document.

How many onload events are fired?  One or two?

Which script is executed?  "foo" or "bar"?

Thanks in advance for the answers (and the corresponding spec clarifications),
Received on Monday, 24 July 2006 16:15:58 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:09 UTC