Migrate core/utils/dom.js to named requires

This commit is contained in:
Aaron Dodson
2021-07-14 15:38:35 -07:00
parent 563defa3ba
commit 1d8f6e903c
2 changed files with 6 additions and 7 deletions

View File

@@ -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<T>} name Element's tag name.
* @param {string|Svg<T>} 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();

View File

@@ -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'], []);