Re: Executing script-inserted external scripts in insertion order

On Wed, Oct 13, 2010 at 9:53 AM, Adam Barth <w3c@adambarth.com> wrote:
> On Wed, Oct 13, 2010 at 1:40 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
>> It would be great if IE or WebKit developers commented on whether this carrot will work. Because if they really consider the carrot compelling, we can standardize that script-inserted async=false external scripts execute in insertion order (relative to themselves only--not relative to script-inserted inline scripts or parser-inserted scripts).
>
> Yeah, I don't know.  I don't mean to be negative, it just seems like a
> really obscure feature.  It's tough enough to educate people to use
> async or defer (and to get them to understand the difference!), and
> those have massive performance benefits.
>
> I've added tonyg to this thread.  He's been most closely involved with
> asynchronous script execution in WebKit.  He might have more insight.

I think from a user education point of view, I would actually argue
that keeping scripts ordered is a better solution. Any time you use
async script you are exposing yourself to race conditions. If scripts
load with a different speed at a users computer than at yours, then
you are running the risk that scripts are running in a different order
than what you have tested with. This could easily happen if all the
scripts have been cached in your browser, but won't be for a user that
visits for the first time.

So any time async scripts are used, that needs a significant amount of
understanding and care by the developer. This includes if the script
is async because it was inserted using the DOM.

So I'd rather that a user that doesn't understand what async and defer
is *don't* use them, and that they in that case get ordered, non-racy,
behavior.

/ Jonas

Received on Wednesday, 13 October 2010 17:47:00 UTC