Prevent fatal errors in browsers that don't support dataset.

This commit is contained in:
Neil Fraser
2018-03-16 14:40:09 -07:00
committed by Neil Fraser
parent 554e644017
commit 6ff49fb3bf
2 changed files with 6 additions and 2 deletions

View File

@@ -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);

View File

@@ -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;
}
};
/**