, DOM-, , , , node node. :
HTML-, , .
HTML:
<body>
<h2> Lets Study DOM!! </h2>
<input type = 'text' id = 'topic'> </input></br>
<button onClick = addToList()> Click Me to Add </button>
JavaScript:
console.log(document.querySelector('body').childNodes);
:
[text, h2, text, input#topic, text, br, text, button, text, ul#unordered, text, script]
, , , node, , :
HTML:
<body><h2> Lets Study DOM!! </h2>
<input type = 'text' id = 'topic'> </input></br>
<button onClick = addToList()> Click Me to Add </button>
JavaScript:
console.log(document.querySelector('body').childNodes);
:
[h2, text, input#topic, text, br, text, button, text, ul#unordered, text, script]
It is so clear that the browser treats the space after the body tag as the text node.