You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/3-event-details/10-onload-ondomcontentloaded/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,9 +67,9 @@ There are two differences between them.
67
67
||`async`|`defer`|
68
68
|---------|---------|---------|
69
69
| Order | Scripts with `async` execute *in the load-first order*. Their document order doesn't matter -- which loads first runs first. | Scripts with `defer` always execute *in the document order* (as they go in the document). |
70
-
|`DOMContentLoaded`| Scripts with `async` may load and execute *before `DOMContentLoaded`*: if they are small, and the document is big, they load faster. | Scripts with `defer`always execute *after `DOMContentLoaded`*: they wait for it if needed. |
70
+
|`DOMContentLoaded`| Scripts with `async` may load and execute while the document has not yet been fully downloaded. | Scripts with `defer` execute after the document is loaded and parsed (they wait if needed), right before `DOMContentLoaded`. |
71
71
72
-
So `async` is used for totally independent scripts, and `defer` is used where we want some order.
72
+
So `async` is used for totally independent scripts.
0 commit comments