Re: Executing script-inserted external scripts in insertion order

On Oct 30, 2010, at 02:38, Tony Gentilcore wrote:

> Nice writeup! The .async=false proposal you outline in the wiki looks great to me. I'm happy to put together a WebKit patch if we settle on it and there's a bug for Hixie to update the spec.

FWIW, the Gecko patch that up for review has the following behavior for .async in spec-ese:

When a script element node is created, if it is being flagged as parser-inserted, set its force-async flag to false. Otherwise, set its force-async flag to true. (Note that createContextualFragment, innerHTML and XSLTProcessor::transformToFragment-created scripts are not flagged as parser-inserted.) This flag setting happens before any attributes are set on the node.

When a previously-created script element node loses its parser-insertedness, if the element doesn't have the async content attribute, set the force-async flag to true and false otherwise.

When a script element node obtains the async content attribute (via setAttribute, setAttributeNode, setAttributeNS, by the fragment parsing algorithm or the XSLTProcessor adding the attribute, etc.), set the force-async flag to false. (Note that calling removeAttribute("async") doesn't modify the force-async flag.)

The async IDL attribute must behave as follows:
 * Upon setting, set the force-async flag to false and then reflect the async content attribute.
 * Upon getting, if the force-async flag is true, return true. Otherwise, reflect the async content attribute.

(And the "run" algorithm for scripts is extended with an additional case for scripts that are external, aren't flagged as parser-inserted and that have the async DOM property reporting false.)

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Tuesday, 2 November 2010 13:49:03 UTC