diff --git a/core/xml.js b/core/xml.js index 21d6996c7..6974502b7 100644 --- a/core/xml.js +++ b/core/xml.js @@ -146,7 +146,9 @@ Blockly.Xml.blockToDom = function(block, opt_noId) { Blockly.utils.xml.createElement(block.isShadow() ? 'shadow' : 'block'); element.setAttribute('type', block.type); if (!opt_noId) { - element.id = block.id; + // It's important to use setAttribute here otherwise IE11 won't serialize + // the block's id when domToText is called. + element.setAttribute('id', block.id); } if (block.mutationToDom) { // Custom data for an advanced block.