W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Questions about script attributes in HTML5

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 24 Aug 2010 22:20:39 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1008242218110.1138@ps20323.dreamhostps.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 24 August 2010 15:20:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:26 UTC