From 59a4db61b228563f342fb01de8ab2ed050c58c6a Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 20 Sep 2018 18:20:51 -0700 Subject: [PATCH] Remove .children access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not supported in node.js’ xmldom package. --- core/xml.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/xml.js b/core/xml.js index 5972b2268..993b71319 100644 --- a/core/xml.js +++ b/core/xml.js @@ -606,7 +606,10 @@ Blockly.Xml.domToBlock = function(xmlBlock, workspace) { * should be added. */ Blockly.Xml.domToVariables = function(xmlVariables, workspace) { - for (var i = 0, xmlChild; xmlChild = xmlVariables.children[i]; i++) { + for (var i = 0, xmlChild; xmlChild = xmlVariables.childNodes[i]; i++) { + if (xmlChild.nodeType != Element.ELEMENT_NODE) { + continue; // Skip text nodes. + } var type = xmlChild.getAttribute('type'); var id = xmlChild.getAttribute('id'); var name = xmlChild.textContent;