[webkit-dev] ASYNC attribute for <script>?

Ian Hickson ian at hixie.ch
Tue Apr 28 11:48:21 PDT 2009


On Tue, 28 Apr 2009, Peter Kasting wrote:
> 
> It's great that WebKit has parallel script **downloading**. But... this 
> still blocks page rendering of all elements below the script and still 
> blocks all execution of subsequent JavaScript.
> 
> I'd like an ASYNC attribute to the SCRIPT tag that implied WebKit should 
> go ahead and render subsequent page elements and go ahead executing 
> subsequent JavaScript. This would make it easy for developers deploying 
> standalone features (carousel, widgets, etc.) to get better page 
> behavior.
> 
> This is esp. important for ads. It's unlikely that we can make much 
> progress amongst ad services to adopt performance improvements that 
> require even a small amount of extra JS coding. It is more likely that 
> we could make inroads in getting them to add a simple "async" attribute.
> 
> The key to accomplish this is that the async-loaded scripts must be able 
> to preserve document.write. This opens up a lot of scenarios - I 
> certainly haven't thought them all through. But Opera has this 
> capability, and in my testing it works (see 
> http://www.stevesouders.com/blog/2008/09/11/delayed-script-execution-in-opera/ 
> ).

HTML5 has <script async> but it doesn't preserve document.write() 
behaviour. I don't understand how that is possible given that a 
document.write() could change the meaning of subsequent tokens, but that 
processing subsequent tokens can have side-effects.

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


More information about the webkit-dev mailing list