From 79bedca5a7e5ffc1ab56ef3add2bc63a74b81307 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 2 Oct 2019 16:12:31 -0700 Subject: [PATCH] Element -> SVGElement (#3140) * Use SVGElement instead of Element for the results of createSvgElement * More SVGElement annotations. --- core/block_animations.js | 4 ++-- core/block_drag_surface.js | 8 ++++---- core/block_svg.js | 2 +- core/bubble.js | 4 ++-- core/comment.js | 2 +- core/field.js | 8 ++++---- core/field_angle.js | 2 +- core/flyout_base.js | 10 +++++----- core/flyout_button.js | 2 +- core/mutator.js | 2 +- core/trashcan.js | 6 +++--- core/workspace_comment_svg.js | 2 +- core/workspace_drag_surface_svg.js | 6 +++--- core/zoom_controls.js | 4 ++-- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/block_animations.js b/core/block_animations.js index 08c742d80..7979d6ae5 100644 --- a/core/block_animations.js +++ b/core/block_animations.js @@ -129,7 +129,7 @@ Blockly.blockAnimations.connectionUiEffect = function(block) { /** * Expand a ripple around a connection. - * @param {!Element} ripple Element to animate. + * @param {!SVGElement} ripple Element to animate. * @param {!Date} start Date of animation's start. * @param {number} scale Scale of workspace. * @private @@ -171,7 +171,7 @@ Blockly.blockAnimations.disconnectUiEffect = function(block) { }; /** * Animate a brief wiggle of a disconnected block. - * @param {!Element} group SVG element to animate. + * @param {!SVGElement} group SVG element to animate. * @param {number} magnitude Maximum degrees skew (reversed for RTL). * @param {!Date} start Date of animation's start. * @private diff --git a/core/block_drag_surface.js b/core/block_drag_surface.js index 45fbae47a..ffdf54729 100644 --- a/core/block_drag_surface.js +++ b/core/block_drag_surface.js @@ -49,7 +49,7 @@ Blockly.BlockDragSurfaceSvg = function(container) { /** * The SVG drag surface. Set once by Blockly.BlockDragSurfaceSvg.createDom. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.BlockDragSurfaceSvg.prototype.SVG_ = null; @@ -57,7 +57,7 @@ Blockly.BlockDragSurfaceSvg.prototype.SVG_ = null; /** * This is where blocks live while they are being dragged if the drag surface * is enabled. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.BlockDragSurfaceSvg.prototype.dragGroup_ = null; @@ -106,7 +106,7 @@ Blockly.BlockDragSurfaceSvg.prototype.createDom = function() { /** * Set the SVG blocks on the drag surface's group and show the surface. * Only one block group should be on the drag surface at a time. - * @param {!Element} blocks Block or group of blocks to place on the drag + * @param {!SVGElement} blocks Block or group of blocks to place on the drag * surface. */ Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow = function(blocks) { @@ -180,7 +180,7 @@ Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation = function() { /** * Provide a reference to the drag group (primarily for * BlockSvg.getRelativeToSurfaceXY). - * @return {Element} Drag surface group element. + * @return {SVGElement} Drag surface group element. */ Blockly.BlockDragSurfaceSvg.prototype.getGroup = function() { return this.dragGroup_; diff --git a/core/block_svg.js b/core/block_svg.js index 20c948de8..c8cf6e6cb 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -915,7 +915,7 @@ Blockly.BlockSvg.prototype.setInsertionMarker = function(insertionMarker) { /** * Return the root node of the SVG or null if none exists. - * @return {Element} The root SVG node (probably a group). + * @return {SVGElement} The root SVG node (probably a group). */ Blockly.BlockSvg.prototype.getSvgRoot = function() { return this.svgGroup_; diff --git a/core/bubble.js b/core/bubble.js index 6e5476a30..8c245631b 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -204,7 +204,7 @@ Blockly.Bubble.prototype.autoLayout_ = true; * Create the bubble's DOM. * @param {!Element} content SVG content for the bubble. * @param {boolean} hasResize Add diagonal resize gripper if true. - * @return {!Element} The bubble's SVG group. + * @return {!SVGElement} The bubble's SVG group. * @private */ Blockly.Bubble.prototype.createDom_ = function(content, hasResize) { @@ -274,7 +274,7 @@ Blockly.Bubble.prototype.createDom_ = function(content, hasResize) { /** * Return the root node of the bubble's SVG group. - * @return {Element} The root SVG node of the bubble's group. + * @return {SVGElement} The root SVG node of the bubble's group. */ Blockly.Bubble.prototype.getSvgRoot = function() { return this.bubbleGroup_; diff --git a/core/comment.js b/core/comment.js index f0fadf12e..ce2b7b642 100644 --- a/core/comment.js +++ b/core/comment.js @@ -99,7 +99,7 @@ Blockly.Comment.prototype.drawIcon_ = function(group) { /** * Create the editor for the comment's bubble. - * @return {!Element} The top-level node of the editor. + * @return {!SVGElement} The top-level node of the editor. * @private */ Blockly.Comment.prototype.createEditor_ = function() { diff --git a/core/field.js b/core/field.js index ea0160c6c..98bae1f50 100644 --- a/core/field.js +++ b/core/field.js @@ -66,7 +66,7 @@ Blockly.Field = function(value, opt_validator, opt_config) { /** * Used to cache the field's tooltip value if setTooltip is called when the * field is not yet initialized. Is *not* guaranteed to be accurate. - * @type {string|Function|!Element} + * @type {string|Function|!SVGElement} * @private */ this.tooltip_ = null; @@ -538,10 +538,10 @@ Blockly.Field.prototype.callValidator = function(text) { /** * Gets the group element for this editable field. * Used for measuring the size and for positioning. - * @return {!Element} The group element. + * @return {!SVGElement} The group element. */ Blockly.Field.prototype.getSvgRoot = function() { - return /** @type {!Element} */ (this.fieldGroup_); + return /** @type {!SVGElement} */ (this.fieldGroup_); }; /** @@ -847,7 +847,7 @@ Blockly.Field.prototype.onMouseDown_ = function(e) { /** * Change the tooltip text for this field. - * @param {string|Function|!Element} newTip Text for tooltip or a parent + * @param {string|Function|!SVGElement} newTip Text for tooltip or a parent * element to link to for its tooltip. */ Blockly.Field.prototype.setTooltip = function(newTip) { diff --git a/core/field_angle.js b/core/field_angle.js index 6bf6e26c8..7ac8df25f 100644 --- a/core/field_angle.js +++ b/core/field_angle.js @@ -236,7 +236,7 @@ Blockly.FieldAngle.prototype.showEditor_ = function() { /** * Create the angle dropdown editor. - * @return {!Element} The newly created angle picker. + * @return {!SVGElement} The newly created angle picker. * @private */ Blockly.FieldAngle.prototype.dropdownCreate_ = function() { diff --git a/core/flyout_base.js b/core/flyout_base.js index e772de121..24326655d 100644 --- a/core/flyout_base.js +++ b/core/flyout_base.js @@ -82,7 +82,7 @@ Blockly.Flyout = function(workspaceOptions) { /** * List of background mats that lurk behind each block to catch clicks * landing in the blocks' lakes and bays. - * @type {!Array.} + * @type {!Array.} * @private */ this.mats_ = []; @@ -211,7 +211,7 @@ Blockly.Flyout.prototype.dragAngleRange_ = 70; * separate svg element. * @param {string} tagName The type of tag to put the flyout in. This * should be or . - * @return {!Element} The flyout's SVG group. + * @return {!SVGElement} The flyout's SVG group. */ Blockly.Flyout.prototype.createDom = function(tagName) { /* @@ -569,10 +569,10 @@ Blockly.Flyout.prototype.clearOldBlocks_ = function() { /** * Add listeners to a block that has been added to the flyout. - * @param {!Element} root The root node of the SVG group the block is in. + * @param {!SVGElement} root The root node of the SVG group the block is in. * @param {!Blockly.Block} block The block to add listeners for. - * @param {!Element} rect The invisible rectangle under the block that acts as - * a mat for that block. + * @param {!SVGElement} rect The invisible rectangle under the block that acts + * as a mat for that block. * @protected */ Blockly.Flyout.prototype.addBlockListeners_ = function(root, block, rect) { diff --git a/core/flyout_button.js b/core/flyout_button.js index 0dac1fdf8..47d8a973e 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -115,7 +115,7 @@ Blockly.FlyoutButton.prototype.onMouseUpWrapper_ = null; /** * Create the button elements. - * @return {!Element} The button's SVG group. + * @return {!SVGElement} The button's SVG group. */ Blockly.FlyoutButton.prototype.createDom = function() { var cssClass = this.isLabel_ ? 'blocklyFlyoutLabel' : 'blocklyFlyoutButton'; diff --git a/core/mutator.js b/core/mutator.js index 71e10dec0..c06359267 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -118,7 +118,7 @@ Blockly.Mutator.prototype.iconClick_ = function(e) { /** * Create the editor for the mutator's bubble. - * @return {!Element} The top-level node of the editor. + * @return {!SVGElement} The top-level node of the editor. * @private */ Blockly.Mutator.prototype.createEditor_ = function() { diff --git a/core/trashcan.js b/core/trashcan.js index 78b25b183..7b5d676d5 100644 --- a/core/trashcan.js +++ b/core/trashcan.js @@ -163,14 +163,14 @@ Blockly.Trashcan.prototype.minOpenness_ = 0; /** * The SVG group containing the trash can. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.Trashcan.prototype.svgGroup_ = null; /** * The SVG image element of the trash can lid. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.Trashcan.prototype.svgLid_ = null; @@ -205,7 +205,7 @@ Blockly.Trashcan.prototype.top_ = 0; /** * Create the trash can elements. - * @return {!Element} The trash can's SVG group. + * @return {!SVGElement} The trash can's SVG group. */ Blockly.Trashcan.prototype.createDom = function() { /* Here's the markup that will be generated: diff --git a/core/workspace_comment_svg.js b/core/workspace_comment_svg.js index 93018fc4c..657bae7d8 100644 --- a/core/workspace_comment_svg.js +++ b/core/workspace_comment_svg.js @@ -487,7 +487,7 @@ Blockly.WorkspaceCommentSvg.prototype.setDragging = function(adding) { /** * Return the root node of the SVG or null if none exists. - * @return {Element} The root SVG node (probably a group). + * @return {SVGElement} The root SVG node (probably a group). * @package */ Blockly.WorkspaceCommentSvg.prototype.getSvgRoot = function() { diff --git a/core/workspace_drag_surface_svg.js b/core/workspace_drag_surface_svg.js index a51a23689..9e33f2ae7 100644 --- a/core/workspace_drag_surface_svg.js +++ b/core/workspace_drag_surface_svg.js @@ -45,7 +45,7 @@ Blockly.WorkspaceDragSurfaceSvg = function(container) { /** * The SVG drag surface. Set once by Blockly.WorkspaceDragSurfaceSvg.createDom. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_ = null; @@ -167,9 +167,9 @@ Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide = function(newSurface) { /** * Set the SVG to have the block canvas and bubble canvas in it and then * show the surface. - * @param {!Element} blockCanvas The block canvas element from the + * @param {!SVGElement} blockCanvas The block canvas element from the * workspace. - * @param {!Element} bubbleCanvas The element that contains the bubbles. + * @param {!SVGElement} bubbleCanvas The element that contains the bubbles. * @param {Element} previousSibling The element to insert the block canvas and bubble canvas after when it goes back in the DOM at the end of a drag. * @param {number} width The width of the workspace SVG element. diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 7e02bdb99..0cd53628c 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -68,7 +68,7 @@ Blockly.ZoomControls.prototype.MARGIN_SIDE_ = 20; /** * The SVG group containing the zoom controls. - * @type {Element} + * @type {SVGElement} * @private */ Blockly.ZoomControls.prototype.svgGroup_ = null; @@ -89,7 +89,7 @@ Blockly.ZoomControls.prototype.top_ = 0; /** * Create the zoom controls. - * @return {!Element} The zoom controls SVG group. + * @return {!SVGElement} The zoom controls SVG group. */ Blockly.ZoomControls.prototype.createDom = function() { this.svgGroup_ =