Skip to content

Commit

Permalink
capricorn86#659@trivial: Make sure MutationObserver target is not nul…
Browse files Browse the repository at this point in the history
…l before disconnecting.
  • Loading branch information
victorwedo committed Jan 30, 2023
1 parent e49546c commit 25097ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/happy-dom/src/mutation-observer/MutationObserver.ts
Expand Up @@ -55,7 +55,9 @@ export default class MutationObserver {
* Disconnects.
*/
public disconnect(): void {
(<Node>this.target)._unobserve(this.listener);
if (this.target) {
(<Node>this.target)._unobserve(this.listener);
}
}

/**
Expand Down

0 comments on commit 25097ec

Please sign in to comment.