summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanjo Diaz <juanjo.diazmo@gmail.com>2020-01-23 11:51:51 +0200
committerJuanjo Diaz <juanjo.diazmo@gmail.com>2020-01-23 11:58:16 +0200
commit8394462356042e03f68be9f6d815f008be5c1404 (patch)
tree74348d62a7d0eea85fd3f7791328f4b4a5e1175d
parent2d53a785d521b29dbed9fbe0ec686ad2a34516bf (diff)
downloadnovnc-8394462356042e03f68be9f6d815f008be5c1404.tar.gz
Remove generated HTML by Cursor when it detaches
-rw-r--r--core/util/cursor.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/util/cursor.js b/core/util/cursor.js
index 99fe502..c7a084f 100644
--- a/core/util/cursor.js
+++ b/core/util/cursor.js
@@ -20,7 +20,6 @@ export default class Cursor {
this._canvas.style.pointerEvents = 'none';
// Can't use "display" because of Firefox bug #1445997
this._canvas.style.visibility = 'hidden';
- document.body.appendChild(this._canvas);
}
this._position = { x: 0, y: 0 };
@@ -45,6 +44,8 @@ export default class Cursor {
this._target = target;
if (useFallback) {
+ document.body.appendChild(this._canvas);
+
// FIXME: These don't fire properly except for mouse
/// movement in IE. We want to also capture element
// movement, size changes, visibility, etc.
@@ -78,6 +79,8 @@ export default class Cursor {
window.removeEventListener('touchstart', this._eventHandlers.touchstart, options);
this._target.removeEventListener('touchmove', this._eventHandlers.touchmove, options);
this._target.removeEventListener('touchend', this._eventHandlers.touchend, options);
+
+ document.body.removeChild(this._canvas);
}
this._target = null;