- From: Adam Barth <w3c@adambarth.com>
- Date: Thu, 14 Oct 2010 01:18:34 -0700
- To: Henri Sivonen <hsivonen@iki.fi>
- Cc: public html <public-html@w3.org>, tonyg@chromium.org
On Thu, Oct 14, 2010 at 12:48 AM, Henri Sivonen <hsivonen@iki.fi> wrote: >> >> Yeah, I don't know. I don't mean to be negative, it just seems like a >> >> really obscure feature. > > I think it's more obscure to make async have no effect on script-inserted external scripts while it has an effect on parser-inserted external scripts than to make it have the same effect on both. (Well, not exactly the same, since non-async parser-inserted external scripts maintain order relative to parser-inserted inline scripts, but the ideas being discussed for script-inserted scripts don't involve non-async script-inserted external scripts blocking script-inserted inline scripts.) I meant obscure as in not many people would discover and use the feature. Even explaining what the feature does is very complicated. I agree that the timing of script execution is quite a complicated topic, especially when you throw document.write into the mix. Do async external scripts really behave different than script-inserted external scripts? My understanding is that they both execute as soon as the bytes are available from the network (at least in the spec and/or WebKit). > I agree that making script-inserted external script maintain order among themselves by default and making async=true opt into unordered as-soon-as-possible execution would be a virtuous solution on almost all counts: > * The safe behavior would be the default for authors who aren't prepared to handle the less safe behavior (once IE and WebKit versions that have the old unsafe default have faded away) > * It would allow all browser to Support Existing Content (though IE and WebKit would also have to continue to support script/cache preloading to Support Existing Content) > * The default would go the same way (async=false) for both script-created and parser-created scripts. > > The big question is if we can get to interop via this route. That depends on whether IE and WebKit are willing to change their default behavior for script-inserted external non-async scripts. Are they? It's difficult for me to foresee the consequences of doing that. One of the nice things about the other aspects of the parser is that we can grep the web to get a good sense of the order of magnitude or pages that are affected by each decision. In your proposal, would the async parser-inserted scripts maintain order with the script-inserted scripts? We'd essentially have four kinds of external scripts: 1) Parser-blocking 2) Asynchronous but ordered among this group 3) Deferred to after parsing and ordered among this group 4) Asynchronous-as-soon-as-possible The unadorned external scripts would be (1). Both async and script-inserted would be (2). Defer would put the script into (3). If you where both external and marked async, that would put you in (4). Is there an ordering dependence between (2) and (3)? That would seem to be worthwhile in this plan in the spirit of predictability. It's unfortunate that you have to use JavaScript to access the fastest group, which is (4), but we might hope that we're saving web authors from themselves because (4) is the hardest to author correctly. How does the "ordered" property fit into this picture? I'm not sure if you've dropped it from your proposal or whether I'm not not clear how it fits in. Adam
Received on Thursday, 14 October 2010 08:19:42 UTC