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

255
Visualizações
Why does ScrollTo() not accept a top value of Number.POSITIVE_INFINITY?

I noticed the following:

  • In Chrome, using scrollTo on an element with top set to Number.POSITIVE_INFINITY or Number.MAX_VALUE cause the element to scroll to the top. It is only possible to make the element scroll to the bottom by using a number such as Number.MAX_SAFE_INTEGER. I also tried Number.MAX_SAFE_INTEGER + 1000 and it also worked.
  • In Safari, Number.MAX_SAFE_INTEGER and Number.MAX_VALUE both worked to scroll to the bottom, but Number.POSITIVE_INFINITY also scrolled to the top.
  • In Firefox, the behavior is the same as Safari.

This has been tested on macOS.

Anyway, I'm curious why POSITIVE_INFINITY won't work, and why MAX_VALUE also won't work for Chrome I suppose some source code spelunking would easily reveal the answer. I wonder if the spec has anything to say about it, but the inconsistency in implementations would indicate that maybe it's not rigorously defined.

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