-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
document.elementFromPoint not implemented #1435
Comments
It's impossible to implement it in jsdom currently, because it requires layouting. |
It could at least be stubbed, though. |
In that case feature detection wouldn't work anymore - you can also easily stub it in the |
I'm working on a library (built with Node on server side) that conducts accessibility (A11y) audits on HTML, for which one of the utils has code to check if an element is offscreen, in scrollable area, outside the viewport and various such stuff. document.elementFromPoint was an easy way to calculate it. The issue began when I started writing server side test cases for the utils, via JSDOM. It wasn't supporting it. |
Yeah that will realistically never work in JSDOM. No layout engine = no screen, no scrolling, etc. For your needs I'd recommend something like phantom. |
It's interesting why some angular unit tests in my repo have been passing with jest 22. They test code which uses this method. Now with jest 27, I hit this issue. |
It is unfortunate today that using I propose that document.elementFromPoint(x: number, y: number): Element | null Implementation: document.elementFromPoint = function elementFromPoint() {
return null;
} I am happy to raise a pull request @domenic if it is helpful |
document.elementFromPoint is not implemented by jsdom. Raising it as an issue cos it was raised elsewhere inikulin/parse5#50
The text was updated successfully, but these errors were encountered: