Skip to content

Commit 1d98292

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

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/vs/base/browser/dom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,13 @@ export function isAncestor(testChild: Node | null, testAncestor: Node | null): b
695695

696696
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {
697697
while (node && node.nodeType === node.ELEMENT_NODE) {
698-
if (hasClass(node, clazz)) {
698+
if (node.classList.contains(clazz)) {
699699
return node;
700700
}
701701

702702
if (stopAtClazzOrNode) {
703703
if (typeof stopAtClazzOrNode === 'string') {
704-
if (hasClass(node, stopAtClazzOrNode)) {
704+
if (node.classList.contains(stopAtClazzOrNode)) {
705705
return null;
706706
}
707707
} else {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ class PropertyHeader extends Disposable {
9999
buildHeader(): void {
100100
let metadataChanged = this.accessor.checkIfModified(this.cell);
101101
this._foldingIndicator = DOM.append(this.metadataHeaderContainer, DOM.$('.property-folding-indicator'));
102-
DOM.addClass(this._foldingIndicator, this.accessor.prefix);
102+
this._foldingIndicator.classList.add(this.accessor.prefix);
103103
this._updateFoldingIcon();
104104
const metadataStatus = DOM.append(this.metadataHeaderContainer, DOM.$('div.property-status'));
105105
this._statusSpan = DOM.append(metadataStatus, DOM.$('span'));
106106

107107
if (metadataChanged) {
108108
this._statusSpan.textContent = this.accessor.changedLabel;
109109
this._statusSpan.style.fontWeight = 'bold';
110-
DOM.addClass(this.metadataHeaderContainer, 'modified');
110+
this.metadataHeaderContainer.classList.add('modified');
111111
} else {
112112
this._statusSpan.textContent = this.accessor.unChangedLabel;
113113
}
@@ -149,7 +149,7 @@ class PropertyHeader extends Disposable {
149149
return;
150150
}
151151

152-
if (!DOM.hasClass(parent, this.accessor.prefix)) {
152+
if (!parent.classList.contains(this.accessor.prefix)) {
153153
return;
154154
}
155155

@@ -181,7 +181,7 @@ class PropertyHeader extends Disposable {
181181
if (metadataChanged) {
182182
this._statusSpan.textContent = this.accessor.changedLabel;
183183
this._statusSpan.style.fontWeight = 'bold';
184-
DOM.addClass(this.metadataHeaderContainer, 'modified');
184+
this.metadataHeaderContainer.classList.add('modified');
185185
const actions: IAction[] = [];
186186
createAndFillInActionBarActions(this._menu, undefined, actions);
187187
this._toolbar.setActions(actions);
@@ -264,13 +264,13 @@ abstract class AbstractCellRenderer extends Disposable {
264264
this._diffEditorContainer = DOM.$('.cell-diff-editor-container');
265265
switch (this.style) {
266266
case 'left':
267-
DOM.addClass(body, 'left');
267+
body.classList.add('left');
268268
break;
269269
case 'right':
270-
DOM.addClass(body, 'right');
270+
body.classList.add('right');
271271
break;
272272
default:
273-
DOM.addClass(body, 'full');
273+
body.classList.add('full');
274274
break;
275275
}
276276

@@ -507,7 +507,7 @@ abstract class AbstractCellRenderer extends Disposable {
507507
ignoreTrimWhitespace: false
508508
});
509509

510-
DOM.addClass(this._metadataEditorContainer!, 'diff');
510+
this._metadataEditorContainer?.classList.add('diff');
511511

512512
const mode = this.modeService.create('json');
513513
const originalMetadataModel = this.modelService.createModel(originalMetadataSource, mode, CellUri.generateCellMetadataUri(this.cell.original!.uri, this.cell.original!.handle), false);
@@ -611,7 +611,7 @@ abstract class AbstractCellRenderer extends Disposable {
611611
ignoreTrimWhitespace: false
612612
});
613613

614-
DOM.addClass(this._outputEditorContainer!, 'diff');
614+
this._outputEditorContainer?.classList.add('diff');
615615

616616
const mode = this.modeService.create('json');
617617
const originalModel = this.modelService.createModel(originalOutputsSource, mode, undefined, true);
@@ -708,7 +708,7 @@ export class DeletedCell extends AbstractCellRenderer {
708708
}
709709

710710
styleContainer(container: HTMLElement) {
711-
DOM.addClass(container, 'removed');
711+
container.classList.add('removed');
712712
}
713713

714714
buildSourceEditor(sourceContainer: HTMLElement): void {
@@ -795,7 +795,7 @@ export class InsertCell extends AbstractCellRenderer {
795795
}
796796

797797
styleContainer(container: HTMLElement): void {
798-
DOM.addClass(container, 'inserted');
798+
container.classList.add('inserted');
799799
}
800800

801801
buildSourceEditor(sourceContainer: HTMLElement): void {
@@ -899,7 +899,7 @@ export class ModifiedCell extends AbstractCellRenderer {
899899
originalEditable: false,
900900
ignoreTrimWhitespace: false
901901
});
902-
DOM.addClass(this._editorContainer, 'diff');
902+
this._editorContainer.classList.add('diff');
903903

904904
this._editor.layout({
905905
width: this.notebookEditor.getLayoutInfo().width - 2 * DIFF_CELL_MARGIN,

0 commit comments

Comments
 (0)