<body>
<div class="other">
<div class="general">
<div><a href="#" class="link" data-title="ok">ссылка</a></div>
<div><a href="#" class="link" data-title="ok">ссылка</a></div>
<div>
<div><a href="#" class="link" data-title="ok">ссылка</a></div>
</div>
</div>
</div>
<script>
const generalParent =(...chlds) => {
let par = chlds[0]
while (par = par.parentElement) {
if (chlds.every(e => par.contains(e))) return par;
}
return null;
}
alert(generalParent (...document.querySelectorAll('a.link'))?.classList)
</script>
</body>