[whatwg] Questions about script attributes in HTML5

Ian Hickson ian at hixie.ch
Tue Aug 24 15:20:39 PDT 2010


On Thu, 29 Jul 2010, zhao Matt wrote:
>
> Quote:
> "The async and defer attributes are boolean attributes that indicate how the
> script should be executed."..."The defer attribute may be specified even if
> the async attribute is specified"
> Do it mean 'async' is equivalent to 'defer'? (namely, are the two attributes
> interchangeable?)

No.


> Quote:
> "The defer and async attributes must not be specified if the src attribute
> is not present."
> Do it mean "if the src attribute is not present, the defer and async
> attributes can be not used" ? (English is not my native language,  :)  )

Yes.


> However, I saw the defer attribute can work on both in-line and external
> scripts . In short,  when the src attribute is not present,  the defer
> attributes can be used.

We disallow that because there are some serious compatibility issues 
regarding document.write() and innerHTML if you implement defer="" on 
inline scripts, so it was easier to just make it not work.

-- 
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