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

261
Visualizações
Query-selecting elements from multiple elements, efficiently

Say you have an array of elements and you want to get all the <p> belonging to the elements in the array.
I can see two possibilities:

  1. Run Element.querySelectorAll() on each element of the array and then concatenate all the various NodeLists of <p>

  2. Run a single Document.querySelectorAll() and then filter out all <p> not belonging to any of the elements in the array

I don't have such a deep knowledge on the mechanics of query selectors to be able to make a thoughtful decision.

What is most performant, to run more queries on smaller elements or to run fewer queries on bigger elements (actually only one on the biggest of them all)?

about 4 years ago · Juan Pablo Isaza
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