W3C home > Mailing lists > Public > public-html@w3.org > October 2010

Re: Executing script-inserted external scripts in insertion order

From: Henri Sivonen <hsivonen@iki.fi>
Date: Thu, 21 Oct 2010 00:52:32 -0700 (PDT)
To: public html <public-html@w3.org>
Message-ID: <811403298.135601.1287647552427.JavaMail.root@cm-mail03.mozilla.org>
Adam Barth wrote:
> > So in order to avoid adding one script execution queue, you propose
> > adding an arbitrary number?
> Yes.

Could you elaborate on why you chose infinity of ordered queues instead of one ordered queue? It seems to me that the Zero One Infinity rule leaves one as another reasonable number of ordered queues.

> > I can see issues with executing scripts without script elements:
> >  * How does one register an onload or an onerror handler? I'd expect
> >  JS libraries that currently provide script loader APIs not to want
> >  to lose the ability to register onload or onerror handlers.
> Alternatively, one could structure the API more like XMLHttpRequest
> and return a ScriptLoader object with various methods.

That seems like pretty serious complexity creep compared to what Kyle was asking for to address his use case.

> >  * What value would document.currentScript have when a script loaded
> >  via document.executeScripts is executing?
> What values does document.currentScript have when running setTimeout
> or an event handler?

For asynchronous events and timouts, null typically, but I'm not entirely sure if nested event loops make it possible to reach a non-null currentScript from a timeout. For synchronous events, currentScript can be a script element if the script element is being evaluated and the event fires synchronously during the evaluation.

> >  * Would onbeforescriptexecute and onafterescriptexecute handlers be
> >  supported? If yes, how would one register the handlers and what
> >  would the .target property of the event objects be?
> I'm not familiar with these events. Are they part of HTML5?

They aren't part of the spec (at least not yet).

Henri Sivonen
Received on Thursday, 21 October 2010 07:53:06 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:06 UTC