From 77e64b39bc3f0a4f546b090e4e1c4d2bcd0ca560 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 2 Oct 2019 17:10:41 -0700 Subject: [PATCH 1/3] Remove unused nulls in disposal --- core/flyout_button.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/flyout_button.js b/core/flyout_button.js index 47d8a973e..e1263d619 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -234,13 +234,10 @@ Blockly.FlyoutButton.prototype.dispose = function() { } if (this.svgGroup_) { Blockly.utils.dom.removeNode(this.svgGroup_); - this.svgGroup_ = null; } if (this.svgText_) { this.workspace_.getThemeManager().unsubscribe(this.svgText_); } - this.workspace_ = null; - this.targetWorkspace_ = null; }; /** From 78dc82f7ac180250fe1a43c888b21872950fd8c7 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 3 Oct 2019 10:40:43 -0700 Subject: [PATCH 2/3] Misc cleanup: annotations, and flyoutButton disposal. --- core/flyout_button.js | 2 +- core/workspace_svg.js | 6 +++--- core/zoom_controls.js | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/flyout_button.js b/core/flyout_button.js index e1263d619..700933a06 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -48,7 +48,7 @@ Blockly.FlyoutButton = function(workspace, targetWorkspace, xml, isLabel) { this.workspace_ = workspace; /** - * @type {!Blockly.Workspace} + * @type {!Blockly.WorkspaceSvg} * @private */ this.targetWorkspace_ = targetWorkspace; diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 87b5610d0..edffca58f 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -921,7 +921,7 @@ Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled = /** * Get the SVG element that forms the drawing surface. - * @return {!Element} SVG element. + * @return {!SVGElement} SVG element. */ Blockly.WorkspaceSvg.prototype.getCanvas = function() { return this.svgBlockCanvas_; @@ -937,7 +937,7 @@ Blockly.WorkspaceSvg.prototype.getBubbleCanvas = function() { /** * Get the SVG element that contains this workspace. - * @return {Element} SVG element. + * @return {SVGElement} SVG element. */ Blockly.WorkspaceSvg.prototype.getParentSvg = function() { if (this.cachedParentSvg_) { @@ -947,7 +947,7 @@ Blockly.WorkspaceSvg.prototype.getParentSvg = function() { while (element) { if (element.tagName == 'svg') { this.cachedParentSvg_ = element; - return element; + return /** @type {!SVGElement} */ (element); } element = element.parentNode; } diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 0cd53628c..3f741875d 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -31,10 +31,14 @@ goog.require('Blockly.utils.dom'); /** * Class for a zoom controls. - * @param {!Blockly.Workspace} workspace The workspace to sit in. + * @param {!Blockly.WorkspaceSVG} workspace The workspace to sit in. * @constructor */ Blockly.ZoomControls = function(workspace) { + /** + * @type {!Blockly.WorkspaceSvg} + * @private + */ this.workspace_ = workspace; }; @@ -128,9 +132,7 @@ Blockly.ZoomControls.prototype.init = function(verticalSpacing) { Blockly.ZoomControls.prototype.dispose = function() { if (this.svgGroup_) { Blockly.utils.dom.removeNode(this.svgGroup_); - this.svgGroup_ = null; } - this.workspace_ = null; }; /** From c5e691b88bdd9b57f07e1410aa4ef3ecca27e23e Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 3 Oct 2019 14:26:42 -0700 Subject: [PATCH 3/3] Update workspace_svg.js --- core/workspace_svg.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index edffca58f..fd0de41bb 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -947,9 +947,9 @@ Blockly.WorkspaceSvg.prototype.getParentSvg = function() { while (element) { if (element.tagName == 'svg') { this.cachedParentSvg_ = element; - return /** @type {!SVGElement} */ (element); + return element; } - element = element.parentNode; + element = /** @type {!SVGElement} */ (element.parentNode); } return null; };