Can somebody explain in simple terms, what is the difference between classical DOM parentNode and newly introduced in Firefox 9 parentElement
Can somebody explain in simple terms, what is the difference between classical DOM parentNode
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
parentElementis new to Firefox 9 and to DOM4, but it has been present in all other major browsers for ages.In most cases, it is the same as
parentNode. The only difference comes when a node’sparentNodeis not an element. If so,parentElementisnull.As an example:
Since the
<html>element (document.documentElement) doesn’t have a parent that is an element,parentElementisnull. (There are other, more unlikely, cases whereparentElementcould benull, but you’ll probably never come across them.)