From 0e82677f274c084fa730a077ceb23575b65bb7fd Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 12 Jul 2019 15:42:38 -0700 Subject: [PATCH] Create stub for Node contstants. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ironic that Node doesn’t have Node. Not tested. Fix two missing dependencies. --- core/variables.js | 1 + core/variables_dynamic.js | 1 + core/xml.js | 3 +-- gulpfile.js | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/variables.js b/core/variables.js index 2411d3721..173702a7a 100644 --- a/core/variables.js +++ b/core/variables.js @@ -32,6 +32,7 @@ goog.provide('Blockly.Variables'); goog.require('Blockly.Blocks'); goog.require('Blockly.Msg'); +goog.require('Blockly.utils.xml'); goog.require('Blockly.VariableModel'); goog.require('Blockly.Xml'); diff --git a/core/variables_dynamic.js b/core/variables_dynamic.js index ab47337bb..a17c79e2a 100644 --- a/core/variables_dynamic.js +++ b/core/variables_dynamic.js @@ -30,6 +30,7 @@ goog.provide('Blockly.VariablesDynamic'); goog.require('Blockly.Variables'); goog.require('Blockly.Blocks'); goog.require('Blockly.Msg'); +goog.require('Blockly.utils.xml'); goog.require('Blockly.VariableModel'); goog.require('Blockly.Xml'); diff --git a/core/xml.js b/core/xml.js index f5d2abd41..d7461644f 100644 --- a/core/xml.js +++ b/core/xml.js @@ -266,8 +266,7 @@ Blockly.Xml.cloneShadow_ = function(shadow) { if (node) { textNode = node; node = node.nextSibling; - if (textNode.nodeType == Node.TEXT_NODE && - textNode.data.trim() == '') { + if (textNode.nodeType == Node.TEXT_NODE && textNode.data.trim() == '') { // Prune whitespace before a tag. Blockly.utils.dom.removeNode(textNode); } diff --git a/gulpfile.js b/gulpfile.js index 9f9f44f4d..c870e1b77 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -67,6 +67,13 @@ if (typeof DOMParser !== 'function') { return jsdom.window.document; }; } +if (typeof Node !== 'function') { + var Node = { + ELEMENT_NODE: 1, + TEXT_NODE: 3, + DOCUMENT_POSITION_CONTAINED_BY: 16 + }; +} if (typeof module === 'object') { module.exports = Blockly; } if (typeof window === 'object') { window.Blockly = Blockly; }\n`)) .pipe(gulp.dest('.'));