Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

264
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda