fix: remove calls to removeClass and hasClass (#6413)

* fix: stop using dom.addClass in most cases

* chore: format

* fix: remove use of dom.addClass in toolbox

* chore: lint and format

* fix: add checks around non-constant class names

* fix: switch back to quoted access

* chore: format

* fix: remove calls to removeClass

* chore: format

* chore: remove unused deps

* fix: remove uses of hasClass

* chore: format and lint

* chore: format
This commit is contained in:
Rachel Fenichel
2022-09-13 08:33:49 -07:00
committed by GitHub
parent 26561947fb
commit 5f11f3449f
26 changed files with 164 additions and 145 deletions

View File

@@ -24,7 +24,6 @@ import {MenuItem} from './menuitem.js';
import {Msg} from './msg.js';
import * as aria from './utils/aria.js';
import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
import {Rect} from './utils/rect.js';
import * as svgMath from './utils/svg_math.js';
import * as WidgetDiv from './widgetdiv.js';
@@ -181,7 +180,7 @@ function createWidget_(menu: Menu) {
}
menu.render(div);
const menuDom = menu.getElement();
dom.addClass((menuDom as Element), 'blocklyContextMenu');
menuDom?.classList.add('blocklyContextMenu');
// Prevent system context menu when right-clicking a Blockly context menu.
browserEvents.conditionalBind(
(menuDom as EventTarget), 'contextmenu', null, haltPropagation);