From fb17b0276debcd5f101e879e401a20ae43ccef63 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 19 Sep 2019 22:25:10 -0700 Subject: [PATCH] Remove unused CSS classes. --- core/components/component.js | 3 +- core/components/menu/menu.js | 3 +- core/components/tree/basenode.js | 78 ++--------------------------- core/components/tree/treecontrol.js | 4 +- core/css.js | 3 +- core/toolbox.js | 1 - 6 files changed, 7 insertions(+), 85 deletions(-) diff --git a/core/components/component.js b/core/components/component.js index ae10a207a..9fb3306da 100644 --- a/core/components/component.js +++ b/core/components/component.js @@ -690,8 +690,7 @@ Blockly.Component.prototype.forEachChild = function(f, opt_obj) { * @protected */ Blockly.Component.prototype.indexOfChild = function(child) { - return (this.children_ && child) ? this.children_.indexOf(child) : - -1; + return (this.children_ && child) ? this.children_.indexOf(child) : -1; }; /** diff --git a/core/components/menu/menu.js b/core/components/menu/menu.js index bbd53ff2e..be4905652 100644 --- a/core/components/menu/menu.js +++ b/core/components/menu/menu.js @@ -406,8 +406,7 @@ Blockly.Menu.prototype.handleMouseEnter_ = function(_e) { * @private */ Blockly.Menu.prototype.handleMouseLeave_ = function(_e) { - var el = this.getElement(); - if (el) { + if (this.getElement()) { this.blur(); this.clearHighlighted(); } diff --git a/core/components/tree/basenode.js b/core/components/tree/basenode.js index cef052409..b39301d00 100644 --- a/core/components/tree/basenode.js +++ b/core/components/tree/basenode.js @@ -122,27 +122,12 @@ Blockly.utils.object.inherits(Blockly.tree.BaseNode, Blockly.Component); * indentWidth:number, * cssRoot:string, * cssHideRoot:string, - * cssItem:string, - * cssChildren:string, - * cssChildrenNoLines:string, * cssTreeRow:string, * cssItemLabel:string, * cssTreeIcon:string, - * cssExpandTreeIcon:string, - * cssExpandTreeIconPlus:string, - * cssExpandTreeIconMinus:string, - * cssExpandTreeIconTPlus:string, - * cssExpandTreeIconTMinus:string, - * cssExpandTreeIconLPlus:string, - * cssExpandTreeIconLMinus:string, - * cssExpandTreeIconT:string, - * cssExpandTreeIconL:string, - * cssExpandTreeIconBlank:string, * cssExpandedFolderIcon:string, * cssCollapsedFolderIcon:string, * cssFileIcon:string, - * cssExpandedRootIcon:string, - * cssCollapsedRootIcon:string, * cssSelectedRow:string * }} */ @@ -194,12 +179,12 @@ Blockly.tree.BaseNode.prototype.initAccessibility = function() { var img = this.getIconElement(); if (img) { Blockly.utils.aria.setRole(img, - Blockly.utils.aria.Role.PRESENTATION); + Blockly.utils.aria.Role.PRESENTATION + '1'); } var ei = this.getExpandIconElement(); if (ei) { Blockly.utils.aria.setRole(ei, - Blockly.utils.aria.Role.PRESENTATION); + Blockly.utils.aria.Role.PRESENTATION + '2'); } var ce = this.getChildrenElement(); @@ -631,12 +616,9 @@ Blockly.tree.BaseNode.prototype.isUserCollapsible = function() { * @protected */ Blockly.tree.BaseNode.prototype.toDom = function() { - var childClass = this.config_.cssChildrenNoLines; - var nonEmptyAndExpanded = this.getExpanded() && this.hasChildren(); var children = document.createElement('div'); - children.setAttribute('class', childClass || ''); children.setAttribute('style', this.getLineStyle()); if (nonEmptyAndExpanded) { @@ -645,7 +627,6 @@ Blockly.tree.BaseNode.prototype.toDom = function() { } var node = document.createElement('div'); - node.setAttribute('class', this.config_.cssItem || ''); node.setAttribute('id', this.getId()); node.appendChild(this.getRowDom()); @@ -731,59 +712,6 @@ Blockly.tree.BaseNode.prototype.getExpandIconDom = function() { return document.createElement('span'); }; -/** - * @return {string} The class names of the icon used for expanding the node. - * @protected - */ -Blockly.tree.BaseNode.prototype.getExpandIconClass = function() { - var config = this.config_; - var sb = ''; - sb += config.cssTreeIcon + ' ' + config.cssExpandTreeIcon + ' '; - - if (this.hasChildren()) { - var bits = 0; - /* - Bitmap used to determine which icon to use - 1 Plus - 2 Minus - 4 T Line - 8 L Line - */ - - switch (bits) { - case 1: - sb += config.cssExpandTreeIconPlus; - break; - case 2: - sb += config.cssExpandTreeIconMinus; - break; - case 4: - sb += config.cssExpandTreeIconL; - break; - case 5: - sb += config.cssExpandTreeIconLPlus; - break; - case 6: - sb += config.cssExpandTreeIconLMinus; - break; - case 8: - sb += config.cssExpandTreeIconT; - break; - case 9: - sb += config.cssExpandTreeIconTPlus; - break; - case 10: - sb += config.cssExpandTreeIconTMinus; - break; - default: // 0 - sb += config.cssExpandTreeIconBlank; - } - } else { - sb += config.cssExpandTreeIconBlank; - } - return sb; -}; - /** * @return {string} The line style. * @protected @@ -919,7 +847,7 @@ Blockly.tree.BaseNode.prototype.updateRow = function() { Blockly.tree.BaseNode.prototype.updateExpandIcon = function() { var img = this.getExpandIconElement(); if (img) { - img.className = this.getExpandIconClass(); + img.className = this.config_.cssTreeIcon; } var cel = this.getChildrenElement(); if (cel) { diff --git a/core/components/tree/treecontrol.js b/core/components/tree/treecontrol.js index 4cb9f2d27..df5d77f30 100644 --- a/core/components/tree/treecontrol.js +++ b/core/components/tree/treecontrol.js @@ -54,7 +54,7 @@ Blockly.tree.TreeControl = function(toolbox, config) { this.setSelectedInternal(true); /** - * Currenty selected item. + * Currently selected item. * @private {Blockly.tree.BaseNode} */ this.selectedItem_ = this; @@ -174,8 +174,6 @@ Blockly.tree.TreeControl.prototype.getCalculatedIconClass = function() { var config = this.getConfig(); if (expanded && config.cssExpandedRootIcon) { return config.cssTreeIcon + ' ' + config.cssExpandedRootIcon; - } else if (!expanded && config.cssCollapsedRootIcon) { - return config.cssTreeIcon + ' ' + config.cssCollapsedRootIcon; } return ''; }; diff --git a/core/css.js b/core/css.js index 37377cd13..9ec99dfad 100644 --- a/core/css.js +++ b/core/css.js @@ -367,7 +367,7 @@ Blockly.Css.CONTENT = [ 'font-family: sans-serif;', 'font-size: 11pt;', '}', - + '.blocklyMultilineText {', ' font-family: monospace;', '}', @@ -753,7 +753,6 @@ Blockly.Css.CONTENT = [ 'margin: 0 5px;', '}', - '.blocklyTreeIcon {', 'background-image: url(<<>>/sprites.png);', 'height: 16px;', diff --git a/core/toolbox.js b/core/toolbox.js index 15443a0b2..207ab225e 100644 --- a/core/toolbox.js +++ b/core/toolbox.js @@ -85,7 +85,6 @@ Blockly.Toolbox = function(workspace) { indentWidth: 19, cssRoot: 'blocklyTreeRoot', cssHideRoot: 'blocklyHidden', - cssItem: '', cssTreeRow: 'blocklyTreeRow', cssItemLabel: 'blocklyTreeLabel', cssTreeIcon: 'blocklyTreeIcon',