Avoid exception when cursor was removed from DOM already

This commit is contained in:
Simon Bungartz 2024-01-31 16:16:01 +00:00
parent 48c8e41877
commit bd32922ff8
1 changed files with 3 additions and 1 deletions

View File

@ -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;