[whatwg] Questions about script attributes in HTML5

Aryeh Gregor Simetrical+w3c at gmail.com
Wed Jul 28 10:44:18 PDT 2010


On Wed, Jul 28, 2010 at 1:20 PM, zhao Matt <mattzhaoweb at gmail.com> 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.  It just means that you can specify both, like <script async defer
src="myscript.js"></script>.  In this case, "async" takes precedence
and "defer" is ignored in conforming browsers.

> 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.  I don't know why defer isn't allowed here -- maybe someone else
knows the answer.



More information about the whatwg mailing list