fix: prioritize link elements
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user