You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an error when learning about DOM navigation, in the Walking the DOM, under the Siblings and the parent using nextSibling and previousSibling. These properties return the next and previous node, which is the text node.
// parent of <body> is <html>alert(document.body.parentNode===document.documentElement);// true// after <head> goes <body>alert(document.head.nextSibling);// Might not be HTMLBodyElement due to text nodes// before <body> goes <head>alert(document.body.previousSibling);// Might not be HTMLHeadElement due to text nodes
If you look at the alert displayed. The nextSibling and previousSibling may not return the expected HTMLBodyElement and HTMLHeadElement due to the presence of a text node.
Please consider updating, or correcting the examples.
Thank you!
The text was updated successfully, but these errors were encountered:
I encountered an error when learning about DOM navigation, in the Walking the DOM, under the Siblings and the parent using
nextSibling
andpreviousSibling
. These properties return the next and previous node, which is the text node.If you look at the alert displayed. The
nextSibling
andpreviousSibling
may not return the expectedHTMLBodyElement
andHTMLHeadElement
due to the presence of a text node.Please consider updating, or correcting the examples.
Thank you!
The text was updated successfully, but these errors were encountered: