fix: container parent filtering

This commit is contained in:
Rohit Rajan
2025-09-16 23:00:20 +05:30
parent 02f09e0a45
commit 2a1b1783d5

View File

@@ -957,19 +957,10 @@ class ClientSelectorGenerator {
);
if (groupedElementsAtPoint.length > 0) {
const hasAnchorTag = groupedElementsAtPoint.some(
(el) => el.tagName === "A"
let filteredElements = this.filterParentChildGroupedElements(
groupedElementsAtPoint
);
let filteredElements = groupedElementsAtPoint;
if (hasAnchorTag) {
// Apply parent-child filtering when anchor tags are present
filteredElements = this.filterParentChildGroupedElements(
groupedElementsAtPoint
);
}
// Sort by DOM depth (deeper elements first for more specificity)
filteredElements.sort((a, b) => {
const aDepth = this.getElementDepth(a);