Replace goog.dom.createDom for creating HTML

This commit is contained in:
Neil Fraser
2018-06-29 17:10:12 -07:00
committed by Neil Fraser
parent dce60fd152
commit ac2fa96d7f
3 changed files with 7 additions and 5 deletions

View File

@@ -30,7 +30,6 @@ goog.require('Blockly.Field');
goog.require('Blockly.Msg');
goog.require('Blockly.utils');
goog.require('goog.dom');
goog.require('goog.math.Coordinate');
goog.require('goog.userAgent');
@@ -193,7 +192,8 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
var div = Blockly.WidgetDiv.DIV;
// Create the input.
var htmlInput = goog.dom.createDom('input', 'blocklyHtmlInput');
var htmlInput = document.createElement('input');
htmlInput.className = 'blocklyHtmlInput';
htmlInput.setAttribute('spellcheck', this.spellcheck_);
var fontSize =
(Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale) + 'pt';
@@ -301,7 +301,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(_e) {
Blockly.FieldTextInput.prototype.validate_ = function() {
var valid = true;
if (!Blockly.FieldTextInput.htmlInput_) {
throw TypeError('htmlInput not defined');
throw Error('htmlInput not defined');
}
var htmlInput = Blockly.FieldTextInput.htmlInput_;
if (this.sourceBlock_) {

View File

@@ -58,7 +58,8 @@ Blockly.inject = function(container, opt_options) {
throw Error('Error: container is not in current document.');
}
var options = new Blockly.Options(opt_options || {});
var subContainer = goog.dom.createDom('div', 'injectionDiv');
var subContainer = document.createElement('div');
subContainer.className = 'injectionDiv';
container.appendChild(subContainer);
var svg = Blockly.createDom_(subContainer, options);

View File

@@ -156,7 +156,8 @@ Blockly.Toolbox.prototype.init = function() {
* HTML container for the Toolbox menu.
* @type {Element}
*/
this.HtmlDiv = goog.dom.createDom('div', 'blocklyToolboxDiv');
this.HtmlDiv = document.createElement('div');
this.HtmlDiv.className = 'blocklyToolboxDiv';
this.HtmlDiv.setAttribute('dir', workspace.RTL ? 'RTL' : 'LTR');
svg.parentNode.insertBefore(this.HtmlDiv, svg);