I have the following html code:
<h1>
When
<!-- Green highlight effect -->
<span class="highlight">banking</span>
meets<br />
<span class="highlight">minimalist</span>
</h1>
And i wrote the following code in js:
const h1 = document.querySelector('h1');
// Going downwards: child
console.log(h1.childNodes); //prints text element(**When**)
console.log(h1.children); // doesn't print text element (**When**)
i understand that children function prints only direct child, but As far as i understand, When is indeed direct child of h1.
Can someone explain me if i'm wrong?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…