Update article.md

This commit is contained in:
Nguyễn Đức Hào 2020-09-26 17:08:31 +07:00 committed by GitHub
parent 5189d51cd7
commit 02e82ad409
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,7 +185,7 @@ But there are also essential differences between them:
| | Order | `DOMContentLoaded` | | | Order | `DOMContentLoaded` |
|---------|---------|---------| |---------|---------|---------|
| `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. | | `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. |
| `defer` | *Document order* (as they go in the document). | Execute after the document is loaded and parsed (they wait if needed), right before `DOMContentLoaded`. | | `defer` | *Document order* (as they go in the document). | Execute after the document is loaded and parsed (they wait if needed), right before `DOMContentLoaded`. |
In practice, `defer` is used for scripts that need the whole DOM and/or their relative execution order is important. In practice, `defer` is used for scripts that need the whole DOM and/or their relative execution order is important.