From 6c6296d74a44decbde5304141425663ef0fa2d18 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Thu, 16 Jan 2020 13:33:24 -0800 Subject: [PATCH] Use setAttribute for setting the id instead of block.id as IE doesn't serialize the id otherwise. (#3604) --- core/xml.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.