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;