capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.25k stars 197 forks source link

Feature Request: Implement document.elementsFromPoint #1283

Open samschurter opened 6 months ago

samschurter commented 6 months ago

Is your feature request related to a problem? Please describe. My code uses document.elementsFromPoint(), but happy-dom doesn't provide that API.

Describe the solution you'd like elementsFromPoint is implemented and behaves as described in the spec

Describe alternatives you've considered I have been mocking it manually in my Vite tests:

      window.document.elementsFromPoint = vi.fn().mockReturnValue([{
        tagName: 'IMG',
        getBoundingClientRect: () => ({top: 0, left: 0}),
        width: 256,
        height: 256,
        src: 'https:/i-cant-believe-its-not-a-real-url.com/0.png',
      }]);