js
function getElementsInRange(startX, startY, endX, endY) {
const elementsSet = new Set();
for (let x = startX; x <= endX; x++) {
for (let y = startY; y <= endY; y++) {
const elements = document.elementsFromPoint(x, y);
elements.forEach(element => elementsSet.add(element));
}
}
return Array.from(elementsSet);
}
const elementsInRange = getElementsInRange(100, 100, 200, 200);
console.log(elementsInRange);