[whatwg] The Attributes of the script element

Ian Hickson ian at hixie.ch
Tue Aug 24 17:35:58 PDT 2010


On Fri, 30 Jul 2010, zhao Matt wrote:
>
> Quote from: HTML spec -4.3 Scripting
> "Otherwise:
>     The user agent must immediately execute the script block, even if other
> scripts are already executing."
> 
> Quote from: "JavaScript - The Definitive Guide, 5th Edition"
> "The core JavaScript language does not contain any threading mechanism, and
> client-side JavaScript does not add any. Client-side JavaScript is (or
> behaves as if it is) single-threaded."
> 
> Q1: Can JavaScript run in parallel in HTML5 ?
> Obviously, the book thinks Client-side JavaScript is (or behaves as if it
> is) *single-threaded*.
> However,
> HTML5 spec states 'the user agent must immediately execute the script block,
> even if other scripts are *already* executing.',
> Does it imply that scripts can be run in parallel?

No, but it is reentrant, which is what the HTML spec is referring to here.


> Q2:
> Quote from: HTML spec -4.3 Scripting
> "Running a script: When a script element is to be run, the user agent must
> act as follows:..."
> The process includes 9 steps, but I don't sure which step will take the
> attribute 'async' into consideration.

On Fri, 30 Jul 2010, Boris Zbarsky wrote:
> 
> Um... Step 9, which is the only one that mentions it, no?
> 
> Having an "async" attribute prevents a script from taking the first two 
> options in that step.

Right.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list