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

106
Visualizações
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 à 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