Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 28 additions & 30 deletions blockly_accessible_compressed.js

Large diffs are not rendered by default.

58 changes: 28 additions & 30 deletions blockly_compressed.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/block_animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Blockly.BlockAnimations.disposeUiStep_ = function(clone, rtl, start,
var ms = new Date - start;
var percent = ms / 150;
if (percent > 1) {
clone.parentNode.removeChild(clone);
Blockly.utils.removeNode(clone);
} else {
var x = clone.translateX_ +
(rtl ? -1 : 1) * clone.bBox_.width * workspaceScale / 2 * percent;
Expand Down Expand Up @@ -141,7 +141,7 @@ Blockly.BlockAnimations.connectionUiStep_ = function(ripple, start, scale) {
var ms = new Date - start;
var percent = ms / 150;
if (percent > 1) {
ripple.parentNode.removeChild(ripple);
Blockly.utils.removeNode(ripple);
} else {
ripple.setAttribute('r', percent * 25 * scale);
ripple.style.opacity = 1 - percent;
Expand Down
2 changes: 1 addition & 1 deletion core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ Blockly.BlockSvg.prototype.dispose = function(healStack, animate) {
}
Blockly.BlockSvg.superClass_.dispose.call(this, healStack);

this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
blockWorkspace.resizeContents();
// Sever JavaScript to DOM connections.
this.svgGroup_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ Blockly.Bubble.prototype.setColour = function(hexColour) {
Blockly.Bubble.prototype.dispose = function() {
Blockly.Bubble.unbindDragEvents_();
// Dispose of and unlink the bubble.
this.bubbleGroup_.parentNode.removeChild(this.bubbleGroup_);
Blockly.utils.removeNode(this.bubbleGroup_);
this.bubbleGroup_ = null;
this.bubbleArrow_ = null;
this.bubbleBack_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Blockly.Field.prototype.dispose = function() {
}
this.sourceBlock_ = null;
if (this.fieldGroup_) {
this.fieldGroup_.parentNode.removeChild(this.fieldGroup_);
Blockly.utils.removeNode(this.fieldGroup_);
this.fieldGroup_ = null;
}
this.textElement_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/field_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ Blockly.FieldDropdown.prototype.render_ = function() {
this.textElement_.removeChild(child);
}
if (this.imageElement_) {
this.imageElement_.parentNode.removeChild(this.imageElement_);
Blockly.utils.removeNode(this.imageElement_);
this.imageElement_ = null;
}

Expand Down
2 changes: 1 addition & 1 deletion core/field_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Blockly.FieldImage.prototype.init = function() {
*/
Blockly.FieldImage.prototype.dispose = function() {
if (this.fieldGroup_) {
this.fieldGroup_.parentNode.removeChild(this.fieldGroup_);
Blockly.utils.removeNode(this.fieldGroup_);
this.fieldGroup_ = null;
}
this.imageElement_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/field_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Blockly.FieldLabel.prototype.init = function() {
*/
Blockly.FieldLabel.prototype.dispose = function() {
if (this.textElement_) {
this.textElement_.parentNode.removeChild(this.textElement_);
Blockly.utils.removeNode(this.textElement_);
this.textElement_ = null;
}
};
Expand Down
4 changes: 2 additions & 2 deletions core/flyout_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Blockly.Flyout.prototype.dispose = function() {
this.workspace_ = null;
}
if (this.svgGroup_) {
this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
this.svgGroup_ = null;
}
this.svgBackground_ = null;
Expand Down Expand Up @@ -526,7 +526,7 @@ Blockly.Flyout.prototype.clearOldBlocks_ = function() {
for (var j = 0; j < this.mats_.length; j++) {
var rect = this.mats_[j];
if (rect) {
rect.parentNode.removeChild(rect);
Blockly.utils.removeNode(rect);
}
}
this.mats_.length = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/flyout_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Blockly.FlyoutButton.prototype.dispose = function() {
Blockly.unbindEvent_(this.onMouseUpWrapper_);
}
if (this.svgGroup_) {
this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
this.svgGroup_ = null;
}
this.workspace_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Blockly.Icon.prototype.createIcon = function() {
*/
Blockly.Icon.prototype.dispose = function() {
// Dispose of and unlink the icon.
this.iconGroup_.parentNode.removeChild(this.iconGroup_);
Blockly.utils.removeNode(this.iconGroup_);
this.iconGroup_ = null;
// Dispose of and unlink the bubble.
this.setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion core/rendered_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Blockly.RenderedConnection.prototype.unhideAll = function() {
* Remove the highlighting around this connection.
*/
Blockly.RenderedConnection.prototype.unhighlight = function() {
Blockly.Connection.highlightedPath_.parentNode.removeChild(Blockly.Connection.highlightedPath_);
Blockly.utils.removeNode(Blockly.Connection.highlightedPath_);
delete Blockly.Connection.highlightedPath_;
};

Expand Down
4 changes: 2 additions & 2 deletions core/scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Blockly.ScrollbarPair.prototype.oldHostMetrics_ = null;
* Unlink from all DOM elements to prevent memory leaks.
*/
Blockly.ScrollbarPair.prototype.dispose = function() {
this.corner_.parentNode.removeChild(this.corner_);
Blockly.utils.removeNode(this.corner_);
this.corner_ = null;
this.workspace_ = null;
this.oldHostMetrics_ = null;
Expand Down Expand Up @@ -347,7 +347,7 @@ Blockly.Scrollbar.prototype.dispose = function() {
Blockly.unbindEvent_(this.onMouseDownHandleWrapper_);
this.onMouseDownHandleWrapper_ = null;

this.outerSvg_.parentNode.removeChild(this.outerSvg_);
Blockly.utils.removeNode(this.outerSvg_);
this.outerSvg_ = null;
this.svgGroup_ = null;
this.svgBackground_ = null;
Expand Down
2 changes: 1 addition & 1 deletion core/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Blockly.Toolbox.prototype.init = function() {
Blockly.Toolbox.prototype.dispose = function() {
this.flyout_.dispose();
this.tree_.dispose();
this.HtmlDiv.parentNode.removeChild(this.HtmlDiv);
Blockly.utils.removeNode(this.HtmlDiv);
this.workspace_ = null;
this.lastCategory_ = null;
};
Expand Down
2 changes: 1 addition & 1 deletion core/trashcan.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Blockly.Trashcan.prototype.init = function(bottom) {
*/
Blockly.Trashcan.prototype.dispose = function() {
if (this.svgGroup_) {
this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
this.svgGroup_ = null;
}
this.svgLid_ = null;
Expand Down
10 changes: 10 additions & 0 deletions core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ Blockly.utils.hasClass = function(element, className) {
return (' ' + classes + ' ').indexOf(' ' + className + ' ') != -1;
};

/**
* Removes a node from its parent. No-op if not attached to a parent.
* @param {Node} node The node to remove.
* @return {Node} The node removed if removed; else, null.
*/
// Copied from Closure goog.dom.removeNode
Blockly.utils.removeNode = function(node) {
return node && node.parentNode ? node.parentNode.removeChild(node) : null;
};

/**
* Don't do anything for this event, just halt propagation.
* @param {!Event} e An event.
Expand Down
2 changes: 1 addition & 1 deletion core/workspace_comment_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Blockly.WorkspaceCommentSvg.prototype.dispose = function() {
Blockly.Events.fire(new Blockly.Events.CommentDelete(this));
}

this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
// Sever JavaScript to DOM connections.
this.svgGroup_ = null;
this.svgRect_ = null;
Expand Down
4 changes: 2 additions & 2 deletions core/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() {
}
Blockly.WorkspaceSvg.superClass_.dispose.call(this);
if (this.svgGroup_) {
this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
this.svgGroup_ = null;
}
this.svgBlockCanvas_ = null;
Expand Down Expand Up @@ -558,7 +558,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() {
// SVG is injected into (i.e. injectionDiv).
var div = this.getParentSvg().parentNode;
if (div) {
div.parentNode.removeChild(div);
Blockly.utils.removeNode(div);
}
}
if (this.resizeHandlerWrapper_) {
Expand Down
4 changes: 2 additions & 2 deletions core/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ Blockly.Xml.cloneShadow_ = function(shadow) {
if (textNode.nodeType == 3 && textNode.data.trim() == '' &&
node.firstChild != textNode) {
// Prune whitespace after a tag.
textNode.parentNode.removeChild(textNode);
Blockly.utils.removeNode(textNode);
}
}
if (node) {
textNode = node;
node = node.nextSibling;
if (textNode.nodeType == 3 && textNode.data.trim() == '') {
// Prune whitespace before a tag.
textNode.parentNode.removeChild(textNode);
Blockly.utils.removeNode(textNode);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/zoom_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Blockly.ZoomControls.prototype.init = function(bottom) {
*/
Blockly.ZoomControls.prototype.dispose = function() {
if (this.svgGroup_) {
this.svgGroup_.parentNode.removeChild(this.svgGroup_);
Blockly.utils.removeNode(this.svgGroup_);
this.svgGroup_ = null;
}
this.workspace_ = null;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blockly",
"version": "1.20180831.0",
"version": "1.20180904.0",
"description": "Blockly is a library for building visual programming editors.",
"main": "blockly_node_javascript_en.js",
"keywords": [
Expand Down