Reputation: 17776
If I want to test if an element is on the body node is checking the nodeName property accurate enough?
if (element.parentNode.nodeName.toLowerCase()==="body") { }
Upvotes: 0
Views: 1051
Reputation: 10538
Compare the references:
element.parentNode === document.body
Upvotes: 7