javascript-tutorial / javascript-tutorial/en.javascript.info

some description not accurate in the article of 《onload-ondomcontentloaded》

Abierto
#1,842 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
HTML
Estrellas
25.5k
Forks
4k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Abre el artículo enlazado sobre onload-ondomcontentloaded y compara las descripciones citadas de readyState y DOMContentLoaded con la referencia de WHATWG sobre el estado de preparación y la explicación de los scripts defer. Actualiza el artículo para que distinga la transición a interactive del evento DOMContentLoaded posterior y, después, verifica la redacción revisada con esas referencias.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.