mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Replace raw window references with goog.global.window. (#1818)
This should be safer when run within Node.
This commit is contained in:
committed by
GitHub
parent
42e0439aa3
commit
1687275cb2
@@ -464,7 +464,8 @@ Blockly.bindEventWithChecks_ = function(node, name, thisObject, func,
|
||||
};
|
||||
|
||||
var bindData = [];
|
||||
if (window && window.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) {
|
||||
if (goog.global.window && goog.global.window.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]);
|
||||
@@ -516,7 +517,8 @@ Blockly.bindEvent_ = function(node, name, thisObject, func) {
|
||||
};
|
||||
|
||||
var bindData = [];
|
||||
if (window && window.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) {
|
||||
if (goog.global.window && goog.global.window.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]);
|
||||
|
||||
@@ -48,7 +48,7 @@ Blockly.Touch.touchIdentifier_ = null;
|
||||
* @type {Object}
|
||||
*/
|
||||
Blockly.Touch.TOUCH_MAP = {};
|
||||
if (window && window.PointerEvent) {
|
||||
if (goog.global.window && goog.global.window.PointerEvent) {
|
||||
Blockly.Touch.TOUCH_MAP = {
|
||||
'mousedown': ['pointerdown'],
|
||||
'mouseenter': ['pointerenter'],
|
||||
|
||||
Reference in New Issue
Block a user