I am trying to query DOM in Vanilla JavaScript to filter out all elemnts containing the img tags from the parent node with class icon. Example:
After writing query it should return two elements <span> and <a>:
<span class="icon"><a href="#">link</a></span>
<a class="icon" href="#">link</a>
This should not return anything:
<span class="icon"><a href="#"><img src="asdf"></a></span>
<a class="icon" href="#"><img src="asdf"></a>
Using jQuery I can easily achieve this using:
jQuery('.icon').not(':has(img)')
I am finding it bit challenging to implement the same in Vanilla JavaScript.