From b1e4648c3cf8a520bafc8ef770fba5ba5a81fb8f Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 13 Mar 2018 18:34:30 -0700 Subject: [PATCH] Use dataset instead of ID. --- core/block_svg.js | 2 +- core/bubble.js | 4 ++-- core/comment.js | 2 +- core/mutator.js | 2 +- core/warning.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 52b4e6dc2..386fed093 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -101,7 +101,7 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) { workspace, prototypeName, opt_id); // Expose this block's ID on its top-level SVG group. - this.svgGroup_.id = 'block' + this.id; + this.svgGroup_.dataset.blockId = this.id; }; goog.inherits(Blockly.BlockSvg, Blockly.Block); diff --git a/core/bubble.js b/core/bubble.js index 40a999354..acc103f33 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -284,10 +284,10 @@ Blockly.Bubble.prototype.getSvgRoot = function() { /** * Expose the block's ID on the bubble's top-level SVG group. - * @param {string} id Bubble type and ID of block. + * @param {string} id ID of block. */ Blockly.Bubble.prototype.setSvgId = function(id) { - this.bubbleGroup_.id = id; + this.bubbleGroup_.dataset.id = id; }; /** diff --git a/core/comment.js b/core/comment.js index 61f2aaaf9..f355ef8a3 100644 --- a/core/comment.js +++ b/core/comment.js @@ -201,7 +201,7 @@ Blockly.Comment.prototype.setVisible = function(visible) { this.createEditor_(), this.block_.svgPath_, this.iconXY_, this.width_, this.height_); // Expose this comment's block's ID on its top-level SVG group. - this.bubble_.setSvgId('comment' + this.block_.id); + this.bubble_.setSvgId(this.block_.id); this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)); this.updateColour(); } else { diff --git a/core/mutator.js b/core/mutator.js index f80d915f2..0bcbbe6e6 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -250,7 +250,7 @@ Blockly.Mutator.prototype.setVisible = function(visible) { /** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace), this.createEditor_(), this.block_.svgPath_, this.iconXY_, null, null); // Expose this mutator's block's ID on its top-level SVG group. - this.bubble_.setSvgId('mutator' + this.block_.id); + this.bubble_.setSvgId(this.block_.id); var tree = this.workspace_.options.languageTree; if (tree) { this.workspace_.flyout_.init(this.workspace_); diff --git a/core/warning.js b/core/warning.js index 72c75bbfb..ed06d0994 100644 --- a/core/warning.js +++ b/core/warning.js @@ -125,7 +125,7 @@ Blockly.Warning.prototype.setVisible = function(visible) { /** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace), paragraph, this.block_.svgPath_, this.iconXY_, null, null); // Expose this warning's block's ID on its top-level SVG group. - this.bubble_.setSvgId('warning' + this.block_.id); + this.bubble_.setSvgId(this.block_.id); if (this.block_.RTL) { // Right-align the paragraph. // This cannot be done until the bubble is rendered on screen.