[whatwg] Questions about script attributes in HTML5

zhao Matt mattzhaoweb at gmail.com
Wed Jul 28 10:20:26 PDT 2010

"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

I personally consider the two attributes are different. The reason is as
ASYNC tells the browsers to run the script with its following content at the
SAME time(namely, asynchronously).
DEFER tells the browsers to run the script LATER, and to run the following
content first(the browsers will run the script until the page is ready).

"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,  :)  )

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.
Could you give some expanations or tips? thanks
<script type='text/javascript' >
<script type='text/javascript' defer='defer'>
<script type='text/javascript' >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100729/a67ada9b/attachment-0002.htm>

More information about the whatwg mailing list