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

155
Vistas
Live Lists example DomTokenList values

I have a question regarding the console output of the DomTokenList(in general live lists). Why does the first console output also show the 3 values instead of 2. Although I added the third class afterwards. I already set a timeout but the result is the same.

Thanks & Have a nice Sunday

<!DOCTYPE html>
<html lang="en">

<head>

    <style>
.eins {background-color:orange;height:50px;}
.zwei {color:red;}
.drei {width:50px;}

    </style>

</head>

<body>
    <div class="eins zwei">JS</div>

    <script>
var eins=document.querySelector("div");
var klasse=eins.classList;
console.log(klasse);
setTimeout(b,1000);
function b(){
eins.classList.add("drei");
console.log(klasse);}

    </script>

</body>

</html>

Screenshot console output

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Looks good to me, please see the screenshot

about 4 years ago · Juan Pablo Isaza Denunciar

0

It will be updated later. If you set the delay to say 10 seconds and open the list immediately, it contains only 2 items. But it's even easier if you use console.log (klasse.length). It gave me 2 ... 3.

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