Getting unexpected results from calling firstChild
The firstChild method might not work as you expect. For example, in the below block if you select the div and try to get its firstChild, you might be surprised to see that it is the newline and the indentation instead of the span element.
However, if you tried to use firstElementChild instead you would get the span as expected.
<div>
<span>Text</span>
</div>0
1
0