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

168
Views
¿Cuándo `getTargetRanges()` devuelve más de un rango?

Al usar una entrada InputEvent beforeinput puede consultar getTargetRanges() que devuelve una matriz de rangos estáticos que se verán afectados por el evento de entrada.

¿Cuál es un escenario de ejemplo en el que getTargetRanges() devolverá más de un rango? ¿O devuelve una matriz 'por si acaso' habrá tal evento en el futuro? El motivo de la pregunta es que me gustaría probar correctamente el código que se basa en el valor de retorno de getTargetRanges() .

MDN: https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/getTargetRanges
Especificaciones: https://w3c.github.io/input-events/#overview


Patio de juegos:

 document.querySelector('div').addEventListener('beforeinput', (event) => { console.log(event.inputType, event.getTargetRanges().length); if (event.getTargetRanges().length > 1) { alert('how?'); } })
 <div contenteditable> <p>Hello world</p> <p>This is a tyypo</p> </div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Las selecciones múltiples son un ejemplo. Por ejemplo, en Firefox, haga doble clic en una palabra, mantenga presionada la tecla Ctrl/Comando, haga doble clic en otra palabra, retroceda.

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