From 6067290169ca13a24470260fe331fb4632460c7f Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 23 Oct 2019 15:59:43 +0200 Subject: [PATCH] Rename document.capturedElem to captureElement To better fit most naming. --- kasmweb/core/util/cursor.js | 6 +++--- kasmweb/core/util/events.js | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/kasmweb/core/util/cursor.js b/kasmweb/core/util/cursor.js index 0dee4eb..3535813 100644 --- a/kasmweb/core/util/cursor.js +++ b/kasmweb/core/util/cursor.js @@ -233,7 +233,7 @@ export default class Cursor { // When the cursor target has capture we want to show the cursor. // So, if a capture is active - look at the captured element instead. if (this._captureIsActive()) { - target = document.capturedElem; + target = document.captureElement; } if (this._shouldShowCursor(target)) { this._showCursor(); @@ -248,7 +248,7 @@ export default class Cursor { } _captureIsActive() { - return document.capturedElem && - document.documentElement.contains(document.capturedElem); + return document.captureElement && + document.documentElement.contains(document.captureElement); } } diff --git a/kasmweb/core/util/events.js b/kasmweb/core/util/events.js index daaed82..39eefd4 100644 --- a/kasmweb/core/util/events.js +++ b/kasmweb/core/util/events.js @@ -22,7 +22,7 @@ export function stopEvent(e) { // Emulate Element.setCapture() when not supported let _captureRecursion = false; let _elementForUnflushedEvents = null; -document.capturedElem = null; +document.captureElement = null; function _captureProxy(e) { // Recursion protection as we'll see our own event if (_captureRecursion) return; @@ -31,8 +31,8 @@ function _captureProxy(e) { const newEv = new e.constructor(e.type, e); _captureRecursion = true; - if (document.capturedElem) { - document.capturedElem.dispatchEvent(newEv); + if (document.captureElement) { + document.captureElement.dispatchEvent(newEv); } else { _elementForUnflushedEvents.dispatchEvent(newEv); } @@ -55,7 +55,7 @@ function _captureProxy(e) { // Follow cursor style of target element function _capturedElemChanged() { const proxyElem = document.getElementById("noVNC_mouse_capture_elem"); - proxyElem.style.cursor = window.getComputedStyle(document.capturedElem).cursor; + proxyElem.style.cursor = window.getComputedStyle(document.captureElement).cursor; } const _captureObserver = new MutationObserver(_capturedElemChanged); @@ -64,7 +64,7 @@ export function setCapture(target) { if (target.setCapture) { target.setCapture(); - document.capturedElem = target; + document.captureElement = target; // IE releases capture on 'click' events which might not trigger target.addEventListener('mouseup', releaseCapture); @@ -96,7 +96,7 @@ export function setCapture(target) { proxyElem.addEventListener('mouseup', _captureProxy); } - document.capturedElem = target; + document.captureElement = target; // Track cursor and get initial cursor _captureObserver.observe(target, {attributes: true}); @@ -115,10 +115,10 @@ export function releaseCapture() { if (document.releaseCapture) { document.releaseCapture(); - document.capturedElem = null; + document.captureElement = null; } else { - if (!document.capturedElem) { + if (!document.captureElement) { return; } @@ -128,8 +128,8 @@ export function releaseCapture() { // // Before removing the capturedElem pointer we save it to a // temporary variable that the unflushed events can use. - _elementForUnflushedEvents = document.capturedElem; - document.capturedElem = null; + _elementForUnflushedEvents = document.captureElement; + document.captureElement = null; _captureObserver.disconnect();