mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
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:
@@ -15,7 +15,6 @@ goog.declareModuleId('Blockly.ThemeManager');
|
||||
|
||||
import type {Theme} from './theme.js';
|
||||
import * as arrayUtils from './utils/array.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
import type {Workspace} from './workspace.js';
|
||||
import type {WorkspaceSvg} from './workspace_svg.js';
|
||||
|
||||
@@ -61,9 +60,15 @@ export class ThemeManager {
|
||||
const injectionDiv = this.workspace.getInjectionDiv();
|
||||
if (injectionDiv) {
|
||||
if (prevTheme) {
|
||||
dom.removeClass(injectionDiv, prevTheme.getClassName());
|
||||
const oldClassName = prevTheme.getClassName();
|
||||
if (oldClassName) {
|
||||
injectionDiv.classList.remove(oldClassName);
|
||||
}
|
||||
}
|
||||
const newClassName = this.theme.getClassName();
|
||||
if (newClassName) {
|
||||
injectionDiv.classList.add(newClassName);
|
||||
}
|
||||
dom.addClass(injectionDiv, this.theme.getClassName());
|
||||
}
|
||||
|
||||
// Refresh all subscribed workspaces.
|
||||
|
||||
Reference in New Issue
Block a user