Make Cursor.detach() safe to call when not attached

Avoids having checks in higher layers.
This commit is contained in:
Pierre Ossman 2019-11-29 10:08:15 +01:00 committed by Lauri Kasanen
parent a850be4afa
commit 12cdad066e

View File

@ -64,6 +64,10 @@ export default class Cursor {
} }
detach() { detach() {
if (!this._target) {
return;
}
if (useFallback) { if (useFallback) {
const options = { capture: true, passive: true }; const options = { capture: true, passive: true };
this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options); this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options);