Skip to content

Commit c2da750

Browse files
committed
do not use deprecated dom helper methods
#103454
1 parent 93c96b6 commit c2da750

File tree

9 files changed

+26
-30
lines changed

9 files changed

+26
-30
lines changed

src/vs/base/browser/ui/selectBox/selectBoxCustom.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
4545
data.text = dom.append(container, $('.option-text'));
4646
data.decoratorRight = dom.append(container, $('.option-decorator-right'));
4747
data.itemDescription = dom.append(container, $('.option-text-description'));
48-
dom.addClass(data.itemDescription, 'visually-hidden');
48+
data.itemDescription.classList.add('visually-hidden');
4949

5050
return data;
5151
}
@@ -68,10 +68,10 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
6868

6969
// pseudo-select disabled option
7070
if (isDisabled) {
71-
dom.addClass(data.root, 'option-disabled');
71+
data.root.classList.add('option-disabled');
7272
} else {
7373
// Make sure we do class removal from prior template rendering
74-
dom.removeClass(data.root, 'option-disabled');
74+
data.root.classList.remove('option-disabled');
7575
}
7676
}
7777

@@ -162,7 +162,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
162162
this.contextViewProvider = contextViewProvider;
163163
this.selectDropDownContainer = dom.$('.monaco-select-box-dropdown-container');
164164
// Use custom CSS vars for padding calculation (shared with parent select)
165-
dom.addClass(this.selectDropDownContainer, 'monaco-select-box-dropdown-padding');
165+
this.selectDropDownContainer.classList.add('monaco-select-box-dropdown-padding');
166166

167167
// Setup container for select option details
168168
this.selectionDetailsPane = dom.append(this.selectDropDownContainer, $('.select-box-details-pane'));
@@ -309,7 +309,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
309309

310310
public render(container: HTMLElement): void {
311311
this.container = container;
312-
dom.addClass(container, 'select-container');
312+
container.classList.add('select-container');
313313
container.appendChild(this.selectElement);
314314
this.applyStyles();
315315
}
@@ -440,8 +440,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
440440
this.layoutSelectDropDown();
441441
},
442442
onHide: () => {
443-
dom.toggleClass(this.selectDropDownContainer, 'visible', false);
444-
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
443+
this.selectDropDownContainer.classList.remove('visible');
444+
this.selectElement.classList.remove('synthetic-focus');
445445
},
446446
anchorPosition: this._dropDownPosition
447447
}, this.selectBoxOptions.optionsAsChildren ? this.container : undefined);
@@ -455,8 +455,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
455455
render: (container: HTMLElement) => this.renderSelectDropDown(container),
456456
layout: () => this.layoutSelectDropDown(),
457457
onHide: () => {
458-
dom.toggleClass(this.selectDropDownContainer, 'visible', false);
459-
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
458+
this.selectDropDownContainer.classList.remove('visible');
459+
this.selectElement.classList.remove('synthetic-focus');
460460
},
461461
anchorPosition: this._dropDownPosition
462462
}, this.selectBoxOptions.optionsAsChildren ? this.container : undefined);
@@ -529,7 +529,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
529529
if (this.selectList) {
530530

531531
// Make visible to enable measurements
532-
dom.toggleClass(this.selectDropDownContainer, 'visible', true);
532+
this.selectDropDownContainer.classList.add('visible');
533533

534534
const selectPosition = dom.getDomNodePagePosition(this.selectElement);
535535
const styles = getComputedStyle(this.selectElement);
@@ -584,8 +584,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
584584
this.selectDropDownContainer.appendChild(this.selectionDetailsPane);
585585
this.selectDropDownContainer.appendChild(this.selectDropDownListContainer);
586586

587-
dom.removeClass(this.selectionDetailsPane, 'border-top');
588-
dom.addClass(this.selectionDetailsPane, 'border-bottom');
587+
this.selectionDetailsPane.classList.remove('border-top');
588+
this.selectionDetailsPane.classList.add('border-bottom');
589589

590590
} else {
591591
this._dropDownPosition = AnchorPosition.BELOW;
@@ -594,8 +594,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
594594
this.selectDropDownContainer.appendChild(this.selectDropDownListContainer);
595595
this.selectDropDownContainer.appendChild(this.selectionDetailsPane);
596596

597-
dom.removeClass(this.selectionDetailsPane, 'border-bottom');
598-
dom.addClass(this.selectionDetailsPane, 'border-top');
597+
this.selectionDetailsPane.classList.remove('border-bottom');
598+
this.selectionDetailsPane.classList.add('border-top');
599599
}
600600
// Do full layout on showSelectDropDown only
601601
return true;
@@ -655,8 +655,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
655655

656656
// Maintain focus outline on parent select as well as list container - tabindex for focus
657657
this.selectDropDownListContainer.setAttribute('tabindex', '0');
658-
dom.toggleClass(this.selectElement, 'synthetic-focus', true);
659-
dom.toggleClass(this.selectDropDownContainer, 'synthetic-focus', true);
658+
this.selectElement.classList.add('synthetic-focus');
659+
this.selectDropDownContainer.classList.add('synthetic-focus');
660660

661661
return true;
662662
} else {

src/vs/base/browser/ui/selectBox/selectBoxNative.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class SelectBoxNative extends Disposable implements ISelectBoxDelegate {
143143
}
144144

145145
public render(container: HTMLElement): void {
146-
dom.addClass(container, 'select-container');
146+
container.classList.add('select-container');
147147
container.appendChild(this.selectElement);
148148
this.setOptions(this.options, this.selected);
149149
this.applyStyles();

src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable {
627627
return null;
628628
}
629629
// Workaround: since the content widget can not be placed before the first column we need to force the left position
630-
dom.toggleClass(this.domNode, 'line-start', this.range.startColumn === 1);
630+
this.domNode.classList.toggle('line-start', this.range.startColumn === 1);
631631

632632
return {
633633
position: { lineNumber: this.range.startLineNumber, column: this.range.startColumn - 1 },

src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ export class StartDebugActionViewItem implements IActionViewItem {
8484
}
8585
}));
8686
this.toDispose.push(dom.addDisposableListener(this.start, dom.EventType.MOUSE_UP, () => {
87-
dom.removeClass(this.start, 'active');
87+
this.start.classList.remove('active');
8888
}));
8989
this.toDispose.push(dom.addDisposableListener(this.start, dom.EventType.MOUSE_OUT, () => {
90-
dom.removeClass(this.start, 'active');
90+
this.start.classList.remove('active');
9191
}));
9292

9393
this.toDispose.push(dom.addDisposableListener(this.start, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {

src/vs/workbench/contrib/debug/browser/replFilter.ts

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

66
import { matchesFuzzy } from 'vs/base/common/filters';
77
import { splitGlobAware } from 'vs/base/common/glob';
8-
import * as strings from 'vs/base/common/strings';
98
import { ITreeFilter, TreeVisibility, TreeFilterResult } from 'vs/base/browser/ui/tree/tree';
109
import { IReplElement } from 'vs/workbench/contrib/debug/common/debug';
1110
import * as DOM from 'vs/base/browser/dom';
@@ -42,7 +41,7 @@ export class ReplFilter implements ITreeFilter<IReplElement> {
4241
if (query && query !== '') {
4342
const filters = splitGlobAware(query, ',').map(s => s.trim()).filter(s => !!s.length);
4443
for (const f of filters) {
45-
if (strings.startsWith(f, '!')) {
44+
if (f.startsWith('!')) {
4645
this._parsedQueries.push({ type: 'exclude', query: f.slice(1) });
4746
} else {
4847
this._parsedQueries.push({ type: 'include', query: f });

src/vs/workbench/contrib/debug/common/debugger.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as nls from 'vs/nls';
7-
import * as strings from 'vs/base/common/strings';
87
import * as objects from 'vs/base/common/objects';
98
import { isObject } from 'vs/base/common/types';
109
import { IJSONSchema, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema';
@@ -171,7 +170,7 @@ export class Debugger implements IDebugger {
171170
// fix formatting
172171
const editorConfig = this.configurationService.getValue<any>();
173172
if (editorConfig.editor && editorConfig.editor.insertSpaces) {
174-
content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize));
173+
content = content.replace(new RegExp('\t', 'g'), ' '.repeat(editorConfig.editor.tabSize));
175174
}
176175

177176
return Promise.resolve(content);

src/vs/workbench/contrib/debug/common/replModel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { ExpressionContainer } from 'vs/workbench/contrib/debug/common/debugMode
1010
import { isString, isUndefinedOrNull, isObject } from 'vs/base/common/types';
1111
import { basenameOrAuthority } from 'vs/base/common/resources';
1212
import { URI } from 'vs/base/common/uri';
13-
import { endsWith } from 'vs/base/common/strings';
1413
import { generateUuid } from 'vs/base/common/uuid';
1514
import { Emitter } from 'vs/base/common/event';
1615

@@ -203,7 +202,7 @@ export class ReplModel {
203202

204203
if (typeof data === 'string') {
205204
const previousElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
206-
if (previousElement instanceof SimpleReplElement && previousElement.severity === sev && !endsWith(previousElement.value, '\n') && !endsWith(previousElement.value, '\r\n')) {
205+
if (previousElement instanceof SimpleReplElement && previousElement.severity === sev && !previousElement.value.endsWith('\n') && !previousElement.value.endsWith('\r\n')) {
207206
previousElement.value += data;
208207
this._onDidChangeElements.fire();
209208
} else {

src/vs/workbench/contrib/files/common/explorerModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { isEqual } from 'vs/base/common/extpath';
88
import { posix } from 'vs/base/common/path';
99
import { ResourceMap } from 'vs/base/common/map';
1010
import { IFileStat, IFileService, FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
11-
import { rtrim, startsWithIgnoreCase, startsWith, equalsIgnoreCase } from 'vs/base/common/strings';
11+
import { rtrim, startsWithIgnoreCase, equalsIgnoreCase } from 'vs/base/common/strings';
1212
import { coalesce } from 'vs/base/common/arrays';
1313
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
1414
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
@@ -363,7 +363,7 @@ export class ExplorerItem {
363363
// For performance reasons try to do the comparison as fast as possible
364364
const ignoreCase = !this.fileService.hasCapability(resource, FileSystemProviderCapabilities.PathCaseSensitive);
365365
if (resource && this.resource.scheme === resource.scheme && equalsIgnoreCase(this.resource.authority, resource.authority) &&
366-
(ignoreCase ? startsWithIgnoreCase(resource.path, this.resource.path) : startsWith(resource.path, this.resource.path))) {
366+
(ignoreCase ? startsWithIgnoreCase(resource.path, this.resource.path) : resource.path.startsWith(this.resource.path))) {
367367
return this.findByPath(rtrim(resource.path, posix.sep), this.resource.path.length, ignoreCase);
368368
}
369369

src/vs/workbench/contrib/remote/browser/explorerViewItems.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
1111
import { IRemoteExplorerService, REMOTE_EXPLORER_TYPE_KEY } from 'vs/workbench/services/remote/common/remoteExplorerService';
1212
import { ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
1313
import { IViewDescriptor } from 'vs/workbench/common/views';
14-
import { startsWith } from 'vs/base/common/strings';
1514
import { isStringArray } from 'vs/base/common/types';
1615
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
1716
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
@@ -82,7 +81,7 @@ export class SwitchRemoteViewItem extends SelectActionViewItem {
8281
static createOptionItems(views: IViewDescriptor[], contextKeyService: IContextKeyService): IRemoteSelectItem[] {
8382
let options: IRemoteSelectItem[] = [];
8483
views.forEach(view => {
85-
if (view.group && startsWith(view.group, 'targets') && view.remoteAuthority && (!view.when || contextKeyService.contextMatchesRules(view.when))) {
84+
if (view.group && view.group.startsWith('targets') && view.remoteAuthority && (!view.when || contextKeyService.contextMatchesRules(view.when))) {
8685
options.push({ text: view.name, authority: isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority] });
8786
}
8887
});

0 commit comments

Comments
 (0)