Skip to content

Commit 6f24128

Browse files
authored
Merge pull request #2151 from haond10adp/patch-1
minor change
2 parents f4cf580 + 02e82ad commit 6f24128

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2-ui/5-loading/02-script-async-defer/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
In modern websites, scripts are often "heavier" than HTML: their download size is larger, and processing time is also longer.
55

6-
When the browser loads HTML and comes across a `<script>...</script>` tag, it can't continue building the DOM. It must execute the script right now. The same happens for external scripts `<script src="..."></script>`: the browser must wait until the script downloads, execute it, and only after process the rest of the page.
6+
When the browser loads HTML and comes across a `<script>...</script>` tag, it can't continue building the DOM. It must execute the script right now. The same happens for external scripts `<script src="..."></script>`: the browser must wait for the script to download, execute the downloaded script, and only then can it process the rest of the page.
77

88
That leads to two important issues:
99

@@ -185,7 +185,7 @@ But there are also essential differences between them:
185185

186186
| | Order | `DOMContentLoaded` |
187187
|---------|---------|---------|
188-
| `async` | *Load-first order*. Their document order doesn't matter -- which loads first | Irrelevant. May load and execute while the document has not yet been fully downloaded. That happens if scripts are small or cached, and the document is long enough. |
188+
| `async` | *Load-first order*. Their document order doesn't matter -- which loads first runs first | Irrelevant. May load and execute while the document has not yet been fully downloaded. That happens if scripts are small or cached, and the document is long enough. |
189189
| `defer` | *Document order* (as they go in the document). | Execute after the document is loaded and parsed (they wait if needed), right before `DOMContentLoaded`. |
190190

191191
In practice, `defer` is used for scripts that need the whole DOM and/or their relative execution order is important.

0 commit comments

Comments
 (0)