javascript-tutorial / javascript-tutorial/en.javascript.info
some description not accurate in the article of 《onload-ondomcontentloaded》
- Vorherrschende Sprache
- HTML
- Sterne
- 25.5k
- Forks
- 4k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## article
article Link [《onload-ondomcontentloaded》](https://javascript.info/onload-ondomcontentloaded)
## may not accurate
> document.readyState becomes interactive right before DOMContentLoaded. These two things actually mean the same.
> interactive – the document is parsed, happens at about the same time as DOMContentLoaded, but before it.
## reason
if a page containers some "defer" script, then it will cost some time to execute the "defer" script after interactive but before DCL.
## Reference
https://calendar.perfplanet.com/2012/deciphering-the-critical-rendering-path/
>If you add a script and tag it with “defer”, then you unblock the construction of the DOM: the document interactive state does not have to wait for execution of JavaScript. However, note that this same script will be executed before DCL is fired. Further, recall that JavaScript may query CSSOM, which means that the DCL event may be held until the CSSOM is ready, at which point the script will be executed. In short: we’ve unblocked the “document interactive” state, but we’re still potentially blocking DCL.
https://html.spec.whatwg.org/multipage/dom.html#current-document-readiness
> The DOMContentLoaded event fires after the transition to "interactive" but before the transition to "complete", at the point where all subresources apart from async script elements have loaded.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Öffne den verlinkten Artikel onload-ondomcontentloaded und vergleiche die darin zitierten Beschreibungen von readyState und DOMContentLoaded mit der WHATWG-Referenz zur Bereitschaft und der Erklärung zu defer-Skripten. Aktualisiere den Artikel so, dass er den Übergang zu interactive vom späteren DOMContentLoaded-Ereignis unterscheidet, und überprüfe anschließend die überarbeitete Formulierung anhand dieser Referenzen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100