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/5-loading/02-script-async-defer/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
@@ -31,7 +31,7 @@ There are some workarounds to that. For instance, we can put a script at the bot
31
31
32
32
But this solution is far from perfect. For example, the browser notices the script (and can start downloading it) only after it downloaded the full HTML document. For long HTML documents, that may be a noticeable delay.
33
33
34
-
Such things are invisible for people using very fast connections, but many people in the world still have slow internet speeds and use a far-from-perfect mobile internet connecion.
34
+
Such things are invisible for people using very fast connections, but many people in the world still have slow internet speeds and use a far-from-perfect mobile internet connection.
35
35
36
36
Luckily, there are two `<script>` attributes that solve the problem for us: `defer` and `async`.
37
37
@@ -191,7 +191,7 @@ Please note that if you're using `defer`, then the page is visible *before* the
191
191
192
192
So the user may read the page, but some graphical components are probably not ready yet.
193
193
194
-
There should be "loading" indications in proper places, and not-working buttons should be visually disabled, to clearly show the user what's ready and what's not.
194
+
There should be "loading" indications in the proper places, and not-working buttons should be visually disabled, to clearly show the user what's ready and what's not.
195
195
```
196
196
197
197
In practice, `defer` is used for scripts that need the whole DOM and/or their relative execution order is important. And `async` is used for independent scripts, like counters or ads. And their relative execution order does not matter.
0 commit comments