You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Could it be possible to add support for ResizeObserver?
I'm currently using vitest + happy-dom and I had a poor stub for the ResizeObserver; although it wasn't working but I didn't really know why, at first.
Then I noticed this in my code:
if (typeof global.ResizeObserver !== 'undefined') {
return global.ResizeObserver;
}
So it made me realize that happy-dom already has a ResizeObserver stub with a bunch of // TODO 😅
Describe the solution you'd like
My poor stub is far from optimal so I'm not going to share it here as it's not worth it; and I'm unsure how hard it'd be to build one from scratch.
Is your feature request related to a problem? Please describe.
Could it be possible to add support for ResizeObserver?
I'm currently using vitest + happy-dom and I had a poor stub for the ResizeObserver; although it wasn't working but I didn't really know why, at first.
Then I noticed this in my code:
So it made me realize that happy-dom already has a ResizeObserver stub with a bunch of
// TODO
😅happy-dom/packages/happy-dom/src/resize-observer/ResizeObserver.ts
Line 13 in e6f9127
Describe the solution you'd like
My poor stub is far from optimal so I'm not going to share it here as it's not worth it; and I'm unsure how hard it'd be to build one from scratch.
But I could suggest something like https://github.com/juggle/resize-observer which I found by looking at the code of one of the libraries I use: https://github.com/ZeeCoder/use-resize-observer/blob/465fbc11c92e1b97a1dcb526b44ce4d889956951/tests/ie/polyfilled.tsx#L15-L25
Describe alternatives you've considered
For now the solution for my case is deleting this code
and forcing my poor stub to be applied regardless if there is a ResizeObserver or not
The text was updated successfully, but these errors were encountered: