-
-
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
Support for Intersection Observer? #2032
Comments
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. |
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. |
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? |
+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" |
Is it possible to make use of polyfills to add support of IntersectionObserver or any missing JS feature in JSDOM?
IntersectionObserver polyfill
The text was updated successfully, but these errors were encountered: