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

151
Vistas
Firefox, double click on empty line, contenteditable div

I'm working on a html editor (contenteditable div) and came across this issue: double (or triple) clicking on empty lines like <div><span><br></span></div> behaves differently in safari/chrome and firefox. In safari and chrome the empty lines get highlighted and selected. this is what I expect. but in firefox the caret dissappears and range.startcontainer is the container div (the contenteditable) instead of the empty line. firefox doesn't highlight the span/empty line, I'm OK with that, but I would like to change the behaviour to act like a single click (caret stays in place and range.startcontainer is <span>.

You may ask what I want to to with empty lines. I've made some functions for styling options (change to list/bullet points for example) that should be accessible even when double clicking on the empty line.

I've tried to solve this by saving the start node on the first click and then restore it when the users clicks 2 or more times and bring the caret back by collapsing the range. but I guess there's a better/cleaner solution since it's only needed for ff.

any ideas appreciated!

about 4 years ago · Santiago Trujillo
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