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

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

Aberta
#1,842 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
HTML
Estrelas
25.5k
Forks
4k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Abra o artigo vinculado sobre onload-ondomcontentloaded e compare as descrições citadas de readyState e DOMContentLoaded com a referência da WHATWG sobre prontidão e a explicação de scripts defer. Atualize o artigo para que ele distinga a transição para interactive do evento DOMContentLoaded posterior e, em seguida, verifique a redação revisada com base nessas referências.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
48/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.