Skip to content

Commit

Permalink
fix: [capricorn86#1400] Implement document.elementFromPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TreyVigus committed Apr 27, 2024
1 parent c29f36c commit 53a0257
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/happy-dom/src/nodes/document/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,17 @@ export default class Document extends Node {
return processingInstruction;
}

/**
* Get element at given point
*
* @param _x horizontal coordinate
* @param _y vertical coordinate
* @returns Always returns null since Happy DOM does not render elements and therefore cannot determine which element is at a given point.
*/
public elementFromPoint(_x: number, _y: number): Element | null {
return null;
}

/**
* Imports a node.
*
Expand Down
7 changes: 7 additions & 0 deletions packages/happy-dom/test/nodes/document/Document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1392,4 +1392,11 @@ describe('Document', () => {
expect(document.currentScript).toBe(null);
});
});

describe('elementFromPoint', () => {
it('Returns null.', () => {
const element = document.elementFromPoint(0, 0);
expect(element).toBe(null);
});
});
});

0 comments on commit 53a0257

Please sign in to comment.