From 1d8f6e903c2a74bc4ba9e2eeb0e563becd0ae33c Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Wed, 14 Jul 2021 15:38:35 -0700 Subject: [PATCH] Migrate core/utils/dom.js to named requires --- core/utils/dom.js | 11 +++++------ tests/deps.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/utils/dom.js b/core/utils/dom.js index 7219bd93c..192aba58e 100644 --- a/core/utils/dom.js +++ b/core/utils/dom.js @@ -19,8 +19,8 @@ goog.module('Blockly.utils.dom'); goog.module.declareLegacyNamespace(); -goog.require('Blockly.utils.Svg'); -goog.require('Blockly.utils.userAgent'); +const Svg = goog.require('Blockly.utils.Svg'); +const userAgent = goog.require('Blockly.utils.userAgent'); /** @@ -76,12 +76,11 @@ let canvasContext = null; /** * Helper method for creating SVG elements. - * @param {string|Blockly.utils.Svg} name Element's tag name. + * @param {string|Svg} name Element's tag name. * @param {!Object} attrs Dictionary of attribute names and values. * @param {Element=} opt_parent Optional parent on which to append the element. * @return {T} Newly created SVG element. The return type is {!SVGElement} if - * name is a string or a more specific type if it a member of - * Blockly.utils.Svg + * name is a string or a more specific type if it a member of Svg. * @template T */ const createSvgElement = function(name, attrs, opt_parent) { @@ -267,7 +266,7 @@ const getTextWidth = function(textElement) { // Attempt to compute fetch the width of the SVG text element. try { - if (Blockly.utils.userAgent.IE || Blockly.utils.userAgent.EDGE) { + if (userAgent.IE || userAgent.EDGE) { width = textElement.getBBox().width; } else { width = textElement.getComputedTextLength(); diff --git a/tests/deps.js b/tests/deps.js index dc28906b6..b8b42f583 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -173,7 +173,7 @@ goog.addDependency('../../core/utils/aria.js', ['Blockly.utils.aria'], []); goog.addDependency('../../core/utils/colour.js', ['Blockly.utils.colour'], []); goog.addDependency('../../core/utils/coordinate.js', ['Blockly.utils.Coordinate'], []); goog.addDependency('../../core/utils/deprecation.js', ['Blockly.utils.deprecation'], []); -goog.addDependency('../../core/utils/dom.js', ['Blockly.utils.dom'], ['Blockly.utils.Svg', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'}); +goog.addDependency('../../core/utils/dom.js', ['Blockly.utils.dom'], ['Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/global.js', ['Blockly.utils.global'], []); goog.addDependency('../../core/utils/idgenerator.js', ['Blockly.utils.IdGenerator'], []); goog.addDependency('../../core/utils/keycodes.js', ['Blockly.utils.KeyCodes'], []);