From eff3fcc289662eb38e447035a09e70e37cd88f6e Mon Sep 17 00:00:00 2001 From: Anjali Pal Date: Mon, 2 Nov 2020 14:08:12 -0800 Subject: [PATCH] set data-id on block svgs for IE11 (#4425) --- core/block_svg.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/block_svg.js b/core/block_svg.js index 1b0b370c2..45b05cf41 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -34,6 +34,7 @@ goog.require('Blockly.utils.Coordinate'); goog.require('Blockly.utils.dom'); goog.require('Blockly.utils.object'); goog.require('Blockly.utils.Rect'); +goog.require('Blockly.utils.userAgent'); goog.requireType('Blockly.IASTNodeLocationSvg'); goog.requireType('Blockly.IBoundedElement'); @@ -117,6 +118,10 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) { // Expose this block's ID on its top-level SVG group. if (this.svgGroup_.dataset) { this.svgGroup_.dataset['id'] = this.id; + } else if (Blockly.utils.userAgent.IE) { + // SVGElement.dataset is not available on IE11, but data-* properties + // can be set with setAttribute(). + this.svgGroup_.setAttribute('data-id', this.id); } }; Blockly.utils.object.inherits(Blockly.BlockSvg, Blockly.Block);