Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Why is document.all 'false'?

So I was playing around with document in JavaScript, as an alternate way of using document.getElementById. But why does document.all equal null? I ran a few commands to prove it's even more 'falsy'.

document.all // HTMLAllCollection[1276]
document.all[0] // <html>...</html>

typeof document.all // 'undefined'
!{} // false. works correctly
!document.all // true! WTF

What is this? Other objects work fine. What happened to the document.all object? Is it broken?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

document.all is a non-standard API introduced by IE. It is not considered good practise to use.

For compatibility with websites that depend on it, some other browsers have introduced support for it.

Some websites that use it depend on testing for the presence of document.all to determine if the browser is IE and uses that to assume that the browser has a bunch of bugs and other non-standard APIs provided by IE.

Browsers which added support for compatibility purposes return a falsy value so that they don't get mistakenly identified as IE (and get passed other code which won't work on them).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda