JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<span>
<strong>
<span><!-- If this <span> does not exist, then the <a> will be found. -->
<em>
<a href="#">a</a>
</em>
</span>
</strong>
</span>
</body>
JavaScript
alert($("body > span a").size());