From 9ab746e143785e5511b5b4e8a465a9ad8a48c2ed Mon Sep 17 00:00:00 2001 From: Andrew n marshall Date: Tue, 15 May 2018 17:12:53 -0700 Subject: [PATCH] Another attempt at testing for PointerEvent. (#1870) Advanced compilation error introduced in #1856. Now bypassing window altogether, by testing goog.global.PointerEvent directly. --- core/blockly.js | 3 +-- core/touch.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/blockly.js b/core/blockly.js index 6509d40c1..a627a97f6 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -464,8 +464,7 @@ Blockly.bindEventWithChecks_ = function(node, name, thisObject, func, }; var bindData = []; - var window = goog.global['window']; - if (window && window.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) { + if (goog.global.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) { for (var i = 0, type; type = Blockly.Touch.TOUCH_MAP[name][i]; i++) { node.addEventListener(type, wrapFunc, false); bindData.push([node, type, wrapFunc]); diff --git a/core/touch.js b/core/touch.js index a75c297eb..d5b8c0a36 100644 --- a/core/touch.js +++ b/core/touch.js @@ -48,8 +48,7 @@ Blockly.Touch.touchIdentifier_ = null; * @type {Object} */ Blockly.Touch.TOUCH_MAP = {}; -var window = goog.global['window']; -if (window && window.PointerEvent) { +if (goog.global.PointerEvent) { Blockly.Touch.TOUCH_MAP = { 'mousedown': ['pointerdown'], 'mouseenter': ['pointerenter'],