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

Support for Intersection Observer? #2032

Open
ApoorvSaxena opened this issue Oct 27, 2017 · 4 comments
Open

Support for Intersection Observer? #2032

ApoorvSaxena opened this issue Oct 27, 2017 · 4 comments
Labels
feature layout Blocked on implementing a layout engine

Comments

@ApoorvSaxena
Copy link

Is it possible to make use of polyfills to add support of IntersectionObserver or any missing JS feature in JSDOM?

IntersectionObserver polyfill

@Zirro
Copy link
Member

Zirro commented Oct 27, 2017

...or any missing JS feature in JSDOM?

You can polyfill many missing features, but IntersectionObserver would be of little use since jsdom doesn't do any layouting. We would need at least parts of #1322 implemented first.

@sanderd17
Copy link

As far as I know, JSDOM is mainly used for tests. So it doesn't need a layout engine IMO, but it would need a way to mock elements coming into view and back out again.

@thedamon
Copy link

thedamon commented Oct 17, 2023

Whether or not they function completely, I think a simple way to globally mock supported browser APIs makes everyone's legitimate web targeted code less likely to throw exceptions once it runs in jsdom. Wouldn't that be ideal?

@chad-fossa
Copy link

+1 to having this be a proxy object or something. Letting jsdom sort of just ignore this (and other valid layout engine objects) would let tests "just render" these components. For example, I'm trying to render something with React Testing Library that uses this object and I'm getting "IntersectionObserver is not defined"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature layout Blocked on implementing a layout engine
Projects
None yet
Development

No branches or pull requests

6 participants