I want to know, how to find out recursively all parent nodes of an element. Suppose i have following snippet
<a href="#"><font>Hello</font></a>
In this I would like to find out whether font tag's parent node is an anchor tag or not. Now this can be achieved by simply checking .parentNode property. But what if there are following cases like,
<a href="#"><font><b>Hello<b></font></a>
or
<a href="#"><font><b><u>Hello</u><b></font></a>
So, basically, how to know if we have reached the top most parent node ?
See Question&Answers more detail:os