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

127
Visualizações
Is document.all an object or a function?

The title is the question. (Do not mention functions being objects that are callable; it is not the conventional categorization.)

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

0

.all is a property of the document (or prototype), and that property is a getter that returns a function. In other words, referencing the .all property invokes the getter (which is one function), and then the getter gives you another function. This behavior is specified here (but is way obsolete, and not something you should ever see nowadays).

For example, in Chrome, you can see that the property is a getter in the following:

console.log(
  Object.getOwnPropertyDescriptor(Document.prototype, 'all')
);

and that the value returned is callable by calling it:

document.all();

The value returned by the getter is an HTMLAllCollection.

It doesn't inherit from Function.prototype, so it's not a normal function - it's an exotic object - but it does have a [[Call]] internal method and so is callable and can be called a function. (and functions are also objects, of course, as you know)

about 4 years ago · Juan Pablo Isaza Relatório

0

I would say document.all is an function that returns an object/collection.

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