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
parent 94c89284fc
commit 9f557f5280
1 changed files with 4 additions and 0 deletions

View File

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