Merge pull request #3267 from rachel-fenichel/bugfix_1714

Fix #1714
This commit is contained in:
Rachel Fenichel
2019-10-16 11:59:09 -06:00
committed by GitHub

View File

@@ -389,10 +389,6 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) {
}
var newBlockIds = []; // A list of block IDs added by this call.
Blockly.utils.dom.startTextWidthCache();
// Safari 7.1.3 is known to provide node lists with extra references to
// children beyond the lists' length. Trust the length, do not use the
// looping pattern of checking the index for an object.
var childCount = xml.childNodes.length;
var existingGroup = Blockly.Events.getGroup();
if (!existingGroup) {
Blockly.Events.setGroup(true);
@@ -404,8 +400,7 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) {
}
var variablesFirst = true;
try {
for (var i = 0; i < childCount; i++) {
var xmlChild = xml.childNodes[i];
for (var i = 0, xmlChild; xmlChild = xml.childNodes[i]; i++) {
var name = xmlChild.nodeName.toLowerCase();
if (name == 'block' ||
(name == 'shadow' && !Blockly.Events.recordUndo)) {