From 25ddecab504d2a51fb8d0362df4c8610c86c6c2f Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 10 May 2019 16:39:32 -0700 Subject: [PATCH] Undo workaround for IE10. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to no longer supporting IE10, we don’t need the code added here: https://github.com/google/blockly/commit/92f388000801e5a67aad093ef578b6e930b5840b --- core/block_svg.js | 4 ++-- core/utils.js | 19 +------------------ core/workspace_comment_svg.js | 2 +- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index ea5b51aa7..3b08c919f 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -429,7 +429,7 @@ Blockly.BlockSvg.prototype.moveDuringDrag = function(newLoc) { * @private */ Blockly.BlockSvg.prototype.clearTransformAttributes_ = function() { - Blockly.utils.removeAttribute(this.getSvgRoot(), 'transform'); + this.getSvgRoot().removeAttribute('transform'); }; /** @@ -1194,7 +1194,7 @@ Blockly.BlockSvg.prototype.setHighlighted = function(highlighted) { 'url(#' + this.workspace.options.embossFilterId + ')'); this.svgPathLight_.style.display = 'none'; } else { - Blockly.utils.removeAttribute(this.svgPath_, 'filter'); + this.svgPath_.removeAttribute('filter'); delete this.svgPathLight_.style.display; } }; diff --git a/core/utils.js b/core/utils.js index a97e56a8c..52187c160 100644 --- a/core/utils.js +++ b/core/utils.js @@ -36,22 +36,6 @@ goog.require('goog.dom'); goog.require('goog.math.Coordinate'); -/** - * Remove an attribute from a element even if it's in IE 10. - * Similar to Element.removeAttribute() but it works on SVG elements in IE 10. - * Sets the attribute to null in IE 10, which treats removeAttribute as a no-op - * if it's called on an SVG element. - * @param {!Element} element DOM element to remove attribute from. - * @param {string} attributeName Name of attribute to remove. - */ -Blockly.utils.removeAttribute = function(element, attributeName) { - if (Blockly.utils.userAgent.IE10) { - element.setAttribute(attributeName, null); - } else { - element.removeAttribute(attributeName); - } -}; - /** * Add a CSS class to a element. * Similar to Closure's goog.dom.classes.add, except it handles SVG elements. @@ -93,7 +77,7 @@ Blockly.utils.removeClass = function(element, className) { if (classList.length) { element.setAttribute('class', classList.join(' ')); } else { - Blockly.utils.removeAttribute(element, 'class'); + element.removeAttribute('class'); } return true; }; @@ -1060,7 +1044,6 @@ Blockly.utils.userAgent = {}; // Browsers. Logic from: // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js Blockly.utils.userAgent.IE = has('Trident') || has('MSIE'); - Blockly.utils.userAgent.IE10 = has('MSIE 10.0'); // 10.1 does not exist. Blockly.utils.userAgent.EDGE = has('Edge'); // Useragent for JavaFX: // Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44 diff --git a/core/workspace_comment_svg.js b/core/workspace_comment_svg.js index 61a1655bf..b76614f1a 100644 --- a/core/workspace_comment_svg.js +++ b/core/workspace_comment_svg.js @@ -410,7 +410,7 @@ Blockly.WorkspaceCommentSvg.prototype.moveTo = function(x, y) { * @private */ Blockly.WorkspaceCommentSvg.prototype.clearTransformAttributes_ = function() { - Blockly.utils.removeAttribute(this.getSvgRoot(), 'transform'); + this.getSvgRoot().removeAttribute('transform'); }; /**