From 6ff49fb3bfaf667fcbe17ad1eeaaeb063f221703 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 16 Mar 2018 14:40:09 -0700 Subject: [PATCH] Prevent fatal errors in browsers that don't support dataset. --- core/block_svg.js | 4 +++- core/bubble.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 386fed093..64742b7a5 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -101,7 +101,9 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) { workspace, prototypeName, opt_id); // Expose this block's ID on its top-level SVG group. - this.svgGroup_.dataset.blockId = this.id; + if (this.svgGroup_.dataset) { + this.svgGroup_.dataset.id = this.id; + } }; goog.inherits(Blockly.BlockSvg, Blockly.Block); diff --git a/core/bubble.js b/core/bubble.js index acc103f33..d1a214e6e 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -287,7 +287,9 @@ Blockly.Bubble.prototype.getSvgRoot = function() { * @param {string} id ID of block. */ Blockly.Bubble.prototype.setSvgId = function(id) { - this.bubbleGroup_.dataset.id = id; + if (this.bubbleGroup_.dataset) { + this.bubbleGroup_.dataset.blockId = id; + } }; /**