I have tried to search but have not found an answer to this:
So I know that when a page is passed to or downloaded by a browser a tree structure representation of the page, called the DOM, is generated. Javascript can then be used to manipulate the nodes (objects representing elements) of this tree.
So now if I open Chrome's developer console and execute the command:
document.childNodes;
I get what I expect, namely two nodes which are the DOCTYPE and the html nodes
[<!DOCTYPE html>, html]
If I now assign a variable to the html and then check it's nodes like so:
var htmlNode = document.childNodes[1];
htmlNode.childNodes;
Something weird happens:
I get the "head" node as expected, and then there is a "text" node which I have no idea where it's coming from, then finally the "body" node as expected.
[head, text, body]
My question is where is this "text" node coming from?