lets say i have this html code :
<div>
<a>
<span id="a"> </span>
</a>
</div>
my question :
is there any js property which exposes element’s depth ?
something like :
$("#a").prop ("depth") //3+3=6 +body+form+html jquery selector is just for example.
p.s. i know how to calc the depth. my question is about existing property.
Not built-in, no. You could always make one using
defineGetteranddefineSetter.