Use dataset instead of ID.

This commit is contained in:
Neil Fraser
2018-03-13 18:34:30 -07:00
committed by Neil Fraser
parent 0be4c80224
commit b1e4648c3c
5 changed files with 6 additions and 6 deletions

View File

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

View File

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

View File

@@ -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 {

View File

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

View File

@@ -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.