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
Describe the bug
If you call disconnect() on a MutationObserver instance that is not yet observing any elements, it will fail with this error: TypeError: Cannot read properties of null (reading '_unobserve')
this.target is null until observe() is called, so if you call disconnect before that, it throws the error. I think it should probably be looping over a list (WeakSet?) of observed elements and calling _unobserve on each one.
The text was updated successfully, but these errors were encountered:
Describe the bug
If you call
disconnect()
on a MutationObserver instance that is not yet observing any elements, it will fail with this error:TypeError: Cannot read properties of null (reading '_unobserve')
To Reproduce
Expected behavior
No error
Screenshots
n/a
Device:
Additional context
The bug is here: https://github.com/capricorn86/happy-dom/blob/master/packages/happy-dom/src/mutation-observer/MutationObserver.ts#L58
this.target
is null until observe() is called, so if you call disconnect before that, it throws the error. I think it should probably be looping over a list (WeakSet?) of observed elements and calling_unobserve
on each one.The text was updated successfully, but these errors were encountered: