Skip to content

Commit

Permalink
Merge pull request #1834 from sbungartz/avoid-exception-when-disconne…
Browse files Browse the repository at this point in the history
…cting-after-dom-morph

Avoid exception when cursor was removed from DOM already
  • Loading branch information
samhed committed Feb 22, 2024
2 parents 65e9ecd + bd32922 commit 786aba6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/util/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default class Cursor {
this._target.removeEventListener('mousemove', this._eventHandlers.mousemove, options);
this._target.removeEventListener('mouseup', this._eventHandlers.mouseup, options);

document.body.removeChild(this._canvas);
if (document.contains(this._canvas)) {
document.body.removeChild(this._canvas);
}
}

this._target = null;
Expand Down

0 comments on commit 786aba6

Please sign in to comment.