speed up extraction (#1617)
This commit is contained in:
@@ -703,9 +703,19 @@ function isInteractable(element, hoverStylesMap) {
|
||||
// Check if element has hover styles that change cursor to pointer
|
||||
// This is to handle the case where an element's cursor is "auto", but resolves to "pointer" on hover
|
||||
if (elementCursor === "auto") {
|
||||
// TODO: we need a better algorithm to match the selector with better performance
|
||||
for (const [selector, styles] of hoverStylesMap) {
|
||||
if (element.matches(selector) && styles.cursor === "pointer") {
|
||||
return true;
|
||||
let shouldMatch = false;
|
||||
for (const className of element.classList) {
|
||||
if (selector.includes(className)) {
|
||||
shouldMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldMatch || selector.includes(tagName)) {
|
||||
if (element.matches(selector) && styles.cursor === "pointer") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user