Remove goog.dom.removeChildren

HTML can be nullified with innerHTML, SVG needs a loop.
This commit is contained in:
Neil Fraser
2018-06-29 15:22:43 -07:00
committed by Neil Fraser
parent c8e08109f2
commit f802859547
3 changed files with 10 additions and 6 deletions

View File

@@ -437,7 +437,10 @@ Blockly.FieldDropdown.prototype.render_ = function() {
// Update arrow's colour.
this.arrow_.style.fill = this.sourceBlock_.getColour();
}
goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
var child;
while ((child = this.textElement_.firstChild)) {
this.textElement_.removeChild(child);
}
goog.dom.removeNode(this.imageElement_);
this.imageElement_ = null;

View File

@@ -133,7 +133,8 @@ Blockly.Tooltip.createDom = function() {
return; // Already created.
}
// Create an HTML container for popup overlays (e.g. editor widgets).
Blockly.Tooltip.DIV = goog.dom.createDom('div', 'blocklyTooltipDiv');
Blockly.Tooltip.DIV = document.createElement('div');
Blockly.Tooltip.DIV.className = 'blocklyTooltipDiv';
document.body.appendChild(Blockly.Tooltip.DIV);
};
@@ -287,7 +288,7 @@ Blockly.Tooltip.show_ = function() {
return;
}
// Erase all existing text.
goog.dom.removeChildren(/** @type {!Element} */ (Blockly.Tooltip.DIV));
Blockly.Tooltip.DIV.innerHTML = '';
// Get the new text.
var tip = Blockly.Tooltip.element_.tooltip;
while (typeof tip == 'function') {

View File

@@ -33,7 +33,6 @@
goog.provide('Blockly.WidgetDiv');
goog.require('Blockly.Css');
goog.require('goog.dom');
goog.require('goog.style');
@@ -65,7 +64,8 @@ Blockly.WidgetDiv.createDom = function() {
return; // Already created.
}
// Create an HTML container for popup overlays (e.g. editor widgets).
Blockly.WidgetDiv.DIV = goog.dom.createDom('div', 'blocklyWidgetDiv');
Blockly.WidgetDiv.DIV = document.createElement('div');
Blockly.WidgetDiv.DIV.className = 'blocklyWidgetDiv';
document.body.appendChild(Blockly.WidgetDiv.DIV);
};
@@ -99,7 +99,7 @@ Blockly.WidgetDiv.hide = function() {
Blockly.WidgetDiv.DIV.style.top = '';
Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_();
Blockly.WidgetDiv.dispose_ = null;
goog.dom.removeChildren(Blockly.WidgetDiv.DIV);
Blockly.WidgetDiv.DIV.innerHTML = '';
}
};