Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
Nodo DOM, ¿Por qué html.childNode[2] es el cuerpo?
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>document</title> </head> <body></body> </html>

¿Por qué html.childNode[2] es CUERPO?

Creo que html.childNode[0] es HEAD. y html.childNode[1] es CUERPO.

Pero, html.childNode[1] es #texto. porque pasa esto?? no puedo ver ningun texto...

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

0 - es la head . 1 - es un nodo de texto - ese salto de línea entre cerrar </head> y abrir <body> . Si elimina el salto de línea, el cuerpo tendrá el índice 1.

about 4 years ago · Santiago Gelvez Report

0

como dice en el documento https://developer.mozilla.org/fr/docs/Web/API/Node/childNodes

childNodes incluye todos los nodos secundarios, incluidos los nodos que no son elementos, como texto y comentarios.

para obtener solo el elemento de nodo secundario, debe usar element.children

 var html = document.querySelector('html'); console.log(html.children[0]); console.log(html.children[1]);
 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>document</title> </head> <body></body> </html>

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!