Skip to content

Commit 4b9c60b

Browse files
committed
Remove some deprecated code in ./src/vs/base microsoft#103454
1 parent 4a9caec commit 4b9c60b

9 files changed

Lines changed: 23 additions & 28 deletions

File tree

src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
550550

551551
if (input.value === '') {
552552
this._pendingComment = '';
553-
if (dom.hasClass(this._commentForm, 'expand')) {
554-
dom.removeClass(this._commentForm, 'expand');
555-
}
553+
this._commentForm.classList.remove('expand');
556554
this._commentEditor.getDomNode()!.style.outline = '';
557555
this._error.textContent = '';
558556
dom.addClass(this._error, 'hidden');
@@ -698,18 +696,16 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
698696
}
699697

700698
private expandReplyArea() {
701-
if (!dom.hasClass(this._commentForm, 'expand')) {
702-
dom.addClass(this._commentForm, 'expand');
699+
if (!this._commentForm.classList.contains('expand')) {
700+
this._commentForm.classList.add('expand');
703701
this._commentEditor.focus();
704702
}
705703
}
706704

707705
private hideReplyArea() {
708706
this._commentEditor.setValue('');
709707
this._pendingComment = '';
710-
if (dom.hasClass(this._commentForm, 'expand')) {
711-
dom.removeClass(this._commentForm, 'expand');
712-
}
708+
this._commentForm.classList.remove('expand');
713709
this._commentEditor.getDomNode()!.style.outline = '';
714710
this._error.textContent = '';
715711
dom.addClass(this._error, 'hidden');
@@ -725,7 +721,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
725721
this._disposables.add(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea()));
726722

727723
this._commentEditor.onDidBlurEditorWidget(() => {
728-
if (this._commentEditor.getModel()!.getValueLength() === 0 && dom.hasClass(this._commentForm, 'expand')) {
724+
if (this._commentEditor.getModel()!.getValueLength() === 0 && this._commentForm.classList.add('expand')) {
729725
dom.removeClass(this._commentForm, 'expand');
730726
}
731727
});

src/vs/workbench/contrib/notebook/browser/contrib/fold/folding.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
77
import { INotebookEditor, INotebookEditorMouseEvent, INotebookEditorContribution, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
8-
import * as DOM from 'vs/base/browser/dom';
98
import { CellFoldingState, FoldingModel } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
109
import { CellKind, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1110
import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
@@ -117,10 +116,10 @@ export class FoldingController extends Disposable implements INotebookEditorCont
117116

118117
const target = e.event.target as HTMLElement;
119118

120-
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
119+
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
121120
const parent = target.parentElement as HTMLElement;
122121

123-
if (!DOM.hasClass(parent, 'notebook-folding-indicator')) {
122+
if (!parent.classList.contains('notebook-folding-indicator')) {
124123
return;
125124
}
126125

src/vs/workbench/contrib/notebook/browser/diff/cellComponents.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class PropertyHeader extends Disposable {
142142

143143
const target = e.event.target as HTMLElement;
144144

145-
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
145+
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
146146
const parent = target.parentElement as HTMLElement;
147147

148148
if (!parent) {
@@ -153,7 +153,7 @@ class PropertyHeader extends Disposable {
153153
return;
154154
}
155155

156-
if (!DOM.hasClass(parent, 'property-folding-indicator')) {
156+
if (!parent.classList.contains('property-folding-indicator')) {
157157
return;
158158
}
159159

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
371371
&&
372372
container !== this._body) {
373373

374-
if (DOM.hasClass(container as HTMLElement, 'output')) {
374+
if ((container as HTMLElement).classList.contains('output')) {
375375
return true;
376376
}
377377

@@ -385,7 +385,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
385385
const id = generateUuid();
386386
this._overlayContainer.id = `notebook-${id}`;
387387
this._overlayContainer.className = 'notebookOverlay';
388-
DOM.addClass(this._overlayContainer, 'notebook-editor');
388+
this._overlayContainer.classList.add('notebook-editor');
389389
this._overlayContainer.style.visibility = 'hidden';
390390

391391
this.layoutService.container.appendChild(this._overlayContainer);
@@ -512,7 +512,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
512512
this._webviewTransparentCover.style.display = 'none';
513513

514514
this._register(DOM.addStandardDisposableGenericMouseDownListner(this._overlayContainer, (e: StandardMouseEvent) => {
515-
if (DOM.hasClass(e.target, 'slider') && this._webviewTransparentCover) {
515+
if (e.target.classList.contains('slider') && this._webviewTransparentCover) {
516516
this._webviewTransparentCover.style.display = 'block';
517517
}
518518
}));

src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ export class SettingsEditor2 extends EditorPane {
10411041
const focusedKey = focusedSetting.getAttribute(AbstractSettingRenderer.SETTING_KEY_ATTR);
10421042
if (focusedKey === key &&
10431043
// update `list`s live, as they have a separate "submit edit" step built in before this
1044-
(focusedSetting.parentElement && !DOM.hasClass(focusedSetting.parentElement, 'setting-item-list'))
1044+
(focusedSetting.parentElement && !focusedSetting.parentElement.classList.contains('setting-item-list'))
10451045
) {
10461046

10471047
this.updateModifiedLabelForKey(key);

src/vs/workbench/contrib/search/browser/searchView.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ export class SearchView extends ViewPane {
11421142
}
11431143

11441144
private showsFileTypes(): boolean {
1145-
return dom.hasClass(this.queryDetails, 'more');
1145+
return this.queryDetails.classList.contains('more');
11461146
}
11471147

11481148
toggleCaseSensitive(): void {
@@ -1193,13 +1193,13 @@ export class SearchView extends ViewPane {
11931193

11941194
toggleQueryDetails(moveFocus = true, show?: boolean, skipLayout?: boolean, reverse?: boolean): void {
11951195
const cls = 'more';
1196-
show = typeof show === 'undefined' ? !dom.hasClass(this.queryDetails, cls) : Boolean(show);
1196+
show = typeof show === 'undefined' ? !this.queryDetails.classList.contains(cls) : Boolean(show);
11971197
this.viewletState['query.queryDetailsExpanded'] = show;
11981198
skipLayout = Boolean(skipLayout);
11991199

12001200
if (show) {
12011201
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
1202-
dom.addClass(this.queryDetails, cls);
1202+
this.queryDetails.classList.add(cls);
12031203
if (moveFocus) {
12041204
if (reverse) {
12051205
this.inputPatternExcludes.focus();
@@ -1211,7 +1211,7 @@ export class SearchView extends ViewPane {
12111211
}
12121212
} else {
12131213
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
1214-
dom.removeClass(this.queryDetails, cls);
1214+
this.queryDetails.classList.remove(cls);
12151215
if (moveFocus) {
12161216
this.searchWidget.focus();
12171217
}

src/vs/workbench/contrib/search/browser/searchWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class SearchWidget extends Widget {
207207
}
208208

209209
isReplaceShown(): boolean {
210-
return !dom.hasClass(this.replaceContainer, 'disabled');
210+
return !this.replaceContainer.classList.contains('disabled');
211211
}
212212

213213
isReplaceActive(): boolean {

src/vs/workbench/contrib/searchEditor/browser/searchEditor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,17 +591,17 @@ export class SearchEditor extends BaseTextEditor {
591591

592592
private toggleIncludesExcludes(_shouldShow?: boolean): void {
593593
const cls = 'expanded';
594-
const shouldShow = _shouldShow ?? !DOM.hasClass(this.includesExcludesContainer, cls);
594+
const shouldShow = _shouldShow ?? !this.includesExcludesContainer.classList.contains(cls);
595595

596596
if (shouldShow) {
597597
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
598-
DOM.addClass(this.includesExcludesContainer, cls);
598+
this.includesExcludesContainer.classList.add(cls);
599599
} else {
600600
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
601-
DOM.removeClass(this.includesExcludesContainer, cls);
601+
this.includesExcludesContainer.classList.remove(cls);
602602
}
603603

604-
this.showingIncludesExcludes = DOM.hasClass(this.includesExcludesContainer, cls);
604+
this.showingIncludesExcludes = this.includesExcludesContainer.classList.contains(cls);
605605

606606
this.reLayout();
607607
}

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
730730
dispose(this._widgetManager);
731731

732732
if (this._xterm && this._xterm.element) {
733-
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
733+
this._hadFocusOnExit = this._xterm.element.classList.contains('focus');
734734
}
735735
if (this._wrapperElement) {
736736
if (this._wrapperElement.xterm) {

0 commit comments

Comments
 (0)