fix: prioritize link elements

This commit is contained in:
Rohit Rajan
2025-10-13 10:47:45 +05:30
parent 76459832a2
commit ce2e28aea1

View File

@@ -560,21 +560,20 @@ class ClientSelectorGenerator {
return element.hasAttribute("src"); return element.hasAttribute("src");
} }
if (tagName === "a" && element.hasAttribute("href")) {
return true;
}
if (element.children.length > 0) { if (element.children.length > 0) {
return false; return false;
} }
const text = (element.textContent || "").trim(); const text = (element.textContent || "").trim();
const hasHref = element.hasAttribute("href");
if (text.length > 0) { if (text.length > 0) {
return true; return true;
} }
if (tagName === "a" && hasHref) {
return true;
}
return false; return false;
} }