I want to select img tags which do not wrap under table. The code below should return only 1 as length as this HTML only has 1 img tag not under a table.
Note : Changing the markup/style isn't possible.
console.log(document.querySelectorAll('img').length)
<table align="center">
<tbody>
<tr>
<td style="text-align: center;">
<a href="https://xxx" imageanchor="1" style="margin-left: auto; margin-right: auto;">
<img border="0" src="https://xxx" original="https://xxx" style="">
</a>
</td>
</tr>
<tr>
<td class="tr-caption" style="text-align: center;">Double Trailing</td>
</tr>
</tbody>
</table>
<a href="https://xxx" imageanchor="1" style="margin-left: auto; margin-right: auto;">
<img border="0" src="https://xxx" original="https://yyy" style="">
</a>