From 2f0b02525a4a168c17cc05a207fcbbffd332382c Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 31 May 2019 10:12:57 -0700 Subject: [PATCH] Moved serializing the field's name up to xml.js --- core/field.js | 1 - core/field_variable.js | 1 - core/xml.js | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/field.js b/core/field.js index debb7411f..49da12a0c 100644 --- a/core/field.js +++ b/core/field.js @@ -292,7 +292,6 @@ Blockly.Field.prototype.fromXml = function(fieldElement) { * @package */ Blockly.Field.prototype.toXml = function(fieldElement) { - fieldElement.setAttribute('name', this.name); fieldElement.textContent = this.getValue(); return fieldElement; }; diff --git a/core/field_variable.js b/core/field_variable.js index a2cd7a6bb..29aa44a0c 100644 --- a/core/field_variable.js +++ b/core/field_variable.js @@ -151,7 +151,6 @@ Blockly.FieldVariable.prototype.toXml = function(fieldElement) { // Make sure the variable is initialized. this.initModel(); - fieldElement.setAttribute('name', this.name); fieldElement.setAttribute('id', this.variable_.getId()); fieldElement.textContent = this.variable_.name; fieldElement.setAttribute('variableType', this.variable_.type); diff --git a/core/xml.js b/core/xml.js index 5dbbfab5f..812e46b1b 100644 --- a/core/xml.js +++ b/core/xml.js @@ -109,6 +109,7 @@ Blockly.Xml.blockToDomWithXY = function(block, opt_noId) { Blockly.Xml.fieldToDom_ = function(field) { if (field.isSerializable()) { var container = Blockly.Xml.utils.createElement('field'); + container.setAttribute('name', field.name); return field.toXml(container); } return null;