Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [#1400] Implement document.elementFromPoint #1420

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -1349,6 +1349,17 @@ export default class Document extends Node {
return processingInstruction;
}

/**
* Get element at a given point.
*
* @param _x horizontal coordinate
* @param _y vertical coordinate
* @returns Always returns null since Happy DOM does not render elements.
*/
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 @@ -1409,4 +1409,11 @@ describe('Document', () => {
expect(document.currentScript).toBe(null);
});
});

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