<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
<ul>
<li>Some text</li>
<li>More some text</li>
<li>I need more text</li>
</ul>
<ul>
<li>Some text <a href="#">and some link</a></li>
<li>More some text</li>
<li>I need more text</li>
</ul>
const isLinks = Array
.from(ul.querySelectorAll(':scope > li'))
.every(n => n.childNodes.length === 1 && n.childNodes[0] instanceof HTMLAnchorElement);
const isLinks = Array.prototype.every.call(
ul.children,
({ childNodes: [ a, b ] }) => a.tagName === 'A' && !b,
);