mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
el.style is readonly in strict mode IE. Fixing crash in IE. (#3119)
This commit is contained in:
@@ -606,7 +606,10 @@ Blockly.tree.BaseNode.prototype.toDom = function() {
|
||||
var nonEmptyAndExpanded = this.getExpanded() && this.hasChildren();
|
||||
|
||||
var children = document.createElement('div');
|
||||
children.style = this.getLineStyle();
|
||||
children.style.backgroundPosition = this.getBackgroundPosition();
|
||||
if (!nonEmptyAndExpanded) {
|
||||
children.style.display = 'none';
|
||||
}
|
||||
|
||||
if (nonEmptyAndExpanded) {
|
||||
// children
|
||||
@@ -635,12 +638,10 @@ Blockly.tree.BaseNode.prototype.getPixelIndent_ = function() {
|
||||
* @protected
|
||||
*/
|
||||
Blockly.tree.BaseNode.prototype.getRowDom = function() {
|
||||
var style = 'padding-' + (this.isRightToLeft() ? 'right' : 'left') + ':' +
|
||||
this.getPixelIndent_() + 'px';
|
||||
|
||||
var row = document.createElement('div');
|
||||
row.className = this.getRowClassName();
|
||||
row.style = style;
|
||||
row.style['padding-' + (this.isRightToLeft() ? 'right' : 'left')] =
|
||||
this.getPixelIndent_() + 'px';
|
||||
|
||||
row.appendChild(this.getIconDom());
|
||||
row.appendChild(this.getLabelDom());
|
||||
@@ -690,16 +691,6 @@ Blockly.tree.BaseNode.prototype.getCalculatedIconClass = function() {
|
||||
throw Error('unimplemented abstract method');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string} The line style.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.tree.BaseNode.prototype.getLineStyle = function() {
|
||||
var nonEmptyAndExpanded = this.getExpanded() && this.hasChildren();
|
||||
return 'background-position: ' + this.getBackgroundPosition() + '; ' +
|
||||
(nonEmptyAndExpanded ? '' : 'display: none');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string} The background position style value.
|
||||
* @protected
|
||||
|
||||
Reference in New Issue
Block a user