Do not allow shadow blocks to have non-shadow children.

This commit is contained in:
Neil Fraser
2016-05-29 14:53:29 -07:00
parent d6f84bff56
commit 1db8092f15
2 changed files with 20 additions and 4 deletions

View File

@@ -521,6 +521,12 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
block.setCollapsed(collapsed == 'true');
}
if (xmlBlock.nodeName.toLowerCase() == 'shadow') {
// Ensure all children are also shadows.
var children = block.getChildren();
for (var i = 0, child; child = children[i]; i++) {
goog.asserts.assert(child.isShadow(),
'Shadow block not allowed non-shadow child.');
}
block.setShadow(true);
}
// Give the block a chance to clean up any initial inputs.