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

466
Visualizações
Why changes to element stored by reference in a class "instance" object do not immediately reflect in (Firefox) code inspector?

The title says it all, really. I wasted a lot of time chasing down what I thought was strange behavior using the debugger / inspector in Firefox, but it may just be a rendering timing issue, or my lack of experience with code inspector. I'd like to work around it. Consider this simplified code example:

class Folder
{
   constructor (tabCount)
   {
      this.tabs = [];
      for (let i = 0; i < tabCount; i += 1)
      {
         const me = document.createElement('DIV');
         this.tabs[i] = me;
         this.tabs[i].className = "tab";
         document.body.appendChild(this.tabs[i]);
      }

      selectTab(index)
      {
         this.tabs[index].classList.add('selected');
      }
   }
}
var mainFolder = new Folder(5);
mainFolder.selectTab(0);

//with CSS to give .tab red color and .tab.selected a blue color.

I set a Debugger break point at selectTab(). While paused and stepping, this.tabs[0].classList.add("selected") causes the expected color change in the document, but over in the HTML Inspector tab the class remains "tab" only. Same thing if I alter in the console window with mainFolder.tabs[0].classList.add("selected"). As soon as I resume live code execution, the HTML inspector updates.

This is killing my ability to trace why ultimately my real code is assigning some CSS classes in error - I can't locate exactly in code when it happens because these particular class changes only have an observed impact downstream which isn't immediately visualized. Does anybody know of a way to refresh, or re-render, or otherwise make (even better keep) up-to-date the HTML changes while paused in debug mode?

Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I have to admit I was skeptical about the description of the problem, but sure enough, just tried Firefox v91 and the Inspector tab in the devtools doesn't seem to get updated as you step through the code.

I don't know that you really have anything you can do about it within Firefox, you might want to use another browser for debugging if this is problematic for you. Chromium's devtools update as you go in the scenario you describe, for instance, and I suspect (if you use Windows) Microsoft Edge's would as well.

about 4 years ago · Juan Pablo Isaza Relatório
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