Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
¿Hay una sobrecarga al adjuntar muchos detectores de eventos en lugar de uno iterando?

Digamos que tengo una list de HTMLElement , y quiero verificar si CompoundPath contiene el elemento, ¿hay una sobrecarga para hacer esto?

 for (const item of list) { document.addEventListener("click", () => { if (event.composedPath.includes(item)) { doThing(item); } } }

versus hacer esto:

 document.addEventListener("click", () => { for (const item of list) { if (event.composedPath.includes(item)) { doThing(item); } } }

¿Por qué querría hacerlo de la primera manera? Porque estoy trabajando con Svelte (un sistema basado en componentes como React), y es más fácil hacer cosas en base a componentes (por ejemplo, limpiar el controlador de eventos), en lugar de hacerlo fuera de él.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!