Remove some deprecated code in ./src/vs/base #103454

This commit is contained in:
Benjamin Pasero
2020-09-22 12:53:29 +02:00
parent 4a9caecfb8
commit 4b9c60bb9a
9 changed files with 23 additions and 28 deletions
@@ -550,9 +550,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
if (input.value === '') {
this._pendingComment = '';
if (dom.hasClass(this._commentForm, 'expand')) {
dom.removeClass(this._commentForm, 'expand');
}
this._commentForm.classList.remove('expand');
this._commentEditor.getDomNode()!.style.outline = '';
this._error.textContent = '';
dom.addClass(this._error, 'hidden');
@@ -698,8 +696,8 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
}
private expandReplyArea() {
if (!dom.hasClass(this._commentForm, 'expand')) {
dom.addClass(this._commentForm, 'expand');
if (!this._commentForm.classList.contains('expand')) {
this._commentForm.classList.add('expand');
this._commentEditor.focus();
}
}
@@ -707,9 +705,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
private hideReplyArea() {
this._commentEditor.setValue('');
this._pendingComment = '';
if (dom.hasClass(this._commentForm, 'expand')) {
dom.removeClass(this._commentForm, 'expand');
}
this._commentForm.classList.remove('expand');
this._commentEditor.getDomNode()!.style.outline = '';
this._error.textContent = '';
dom.addClass(this._error, 'hidden');
@@ -725,7 +721,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._disposables.add(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea()));
this._commentEditor.onDidBlurEditorWidget(() => {
if (this._commentEditor.getModel()!.getValueLength() === 0 && dom.hasClass(this._commentForm, 'expand')) {
if (this._commentEditor.getModel()!.getValueLength() === 0 && this._commentForm.classList.add('expand')) {
dom.removeClass(this._commentForm, 'expand');
}
});
@@ -5,7 +5,6 @@
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { INotebookEditor, INotebookEditorMouseEvent, INotebookEditorContribution, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import * as DOM from 'vs/base/browser/dom';
import { CellFoldingState, FoldingModel } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
import { CellKind, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
@@ -117,10 +116,10 @@ export class FoldingController extends Disposable implements INotebookEditorCont
const target = e.event.target as HTMLElement;
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
const parent = target.parentElement as HTMLElement;
if (!DOM.hasClass(parent, 'notebook-folding-indicator')) {
if (!parent.classList.contains('notebook-folding-indicator')) {
return;
}
@@ -142,7 +142,7 @@ class PropertyHeader extends Disposable {
const target = e.event.target as HTMLElement;
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
const parent = target.parentElement as HTMLElement;
if (!parent) {
@@ -153,7 +153,7 @@ class PropertyHeader extends Disposable {
return;
}
if (!DOM.hasClass(parent, 'property-folding-indicator')) {
if (!parent.classList.contains('property-folding-indicator')) {
return;
}
@@ -371,7 +371,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
&&
container !== this._body) {
if (DOM.hasClass(container as HTMLElement, 'output')) {
if ((container as HTMLElement).classList.contains('output')) {
return true;
}
@@ -385,7 +385,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
const id = generateUuid();
this._overlayContainer.id = `notebook-${id}`;
this._overlayContainer.className = 'notebookOverlay';
DOM.addClass(this._overlayContainer, 'notebook-editor');
this._overlayContainer.classList.add('notebook-editor');
this._overlayContainer.style.visibility = 'hidden';
this.layoutService.container.appendChild(this._overlayContainer);
@@ -512,7 +512,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
this._webviewTransparentCover.style.display = 'none';
this._register(DOM.addStandardDisposableGenericMouseDownListner(this._overlayContainer, (e: StandardMouseEvent) => {
if (DOM.hasClass(e.target, 'slider') && this._webviewTransparentCover) {
if (e.target.classList.contains('slider') && this._webviewTransparentCover) {
this._webviewTransparentCover.style.display = 'block';
}
}));
@@ -1041,7 +1041,7 @@ export class SettingsEditor2 extends EditorPane {
const focusedKey = focusedSetting.getAttribute(AbstractSettingRenderer.SETTING_KEY_ATTR);
if (focusedKey === key &&
// update `list`s live, as they have a separate "submit edit" step built in before this
(focusedSetting.parentElement && !DOM.hasClass(focusedSetting.parentElement, 'setting-item-list'))
(focusedSetting.parentElement && !focusedSetting.parentElement.classList.contains('setting-item-list'))
) {
this.updateModifiedLabelForKey(key);
@@ -1142,7 +1142,7 @@ export class SearchView extends ViewPane {
}
private showsFileTypes(): boolean {
return dom.hasClass(this.queryDetails, 'more');
return this.queryDetails.classList.contains('more');
}
toggleCaseSensitive(): void {
@@ -1193,13 +1193,13 @@ export class SearchView extends ViewPane {
toggleQueryDetails(moveFocus = true, show?: boolean, skipLayout?: boolean, reverse?: boolean): void {
const cls = 'more';
show = typeof show === 'undefined' ? !dom.hasClass(this.queryDetails, cls) : Boolean(show);
show = typeof show === 'undefined' ? !this.queryDetails.classList.contains(cls) : Boolean(show);
this.viewletState['query.queryDetailsExpanded'] = show;
skipLayout = Boolean(skipLayout);
if (show) {
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
dom.addClass(this.queryDetails, cls);
this.queryDetails.classList.add(cls);
if (moveFocus) {
if (reverse) {
this.inputPatternExcludes.focus();
@@ -1211,7 +1211,7 @@ export class SearchView extends ViewPane {
}
} else {
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
dom.removeClass(this.queryDetails, cls);
this.queryDetails.classList.remove(cls);
if (moveFocus) {
this.searchWidget.focus();
}
@@ -207,7 +207,7 @@ export class SearchWidget extends Widget {
}
isReplaceShown(): boolean {
return !dom.hasClass(this.replaceContainer, 'disabled');
return !this.replaceContainer.classList.contains('disabled');
}
isReplaceActive(): boolean {
@@ -591,17 +591,17 @@ export class SearchEditor extends BaseTextEditor {
private toggleIncludesExcludes(_shouldShow?: boolean): void {
const cls = 'expanded';
const shouldShow = _shouldShow ?? !DOM.hasClass(this.includesExcludesContainer, cls);
const shouldShow = _shouldShow ?? !this.includesExcludesContainer.classList.contains(cls);
if (shouldShow) {
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
DOM.addClass(this.includesExcludesContainer, cls);
this.includesExcludesContainer.classList.add(cls);
} else {
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
DOM.removeClass(this.includesExcludesContainer, cls);
this.includesExcludesContainer.classList.remove(cls);
}
this.showingIncludesExcludes = DOM.hasClass(this.includesExcludesContainer, cls);
this.showingIncludesExcludes = this.includesExcludesContainer.classList.contains(cls);
this.reLayout();
}
@@ -730,7 +730,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
dispose(this._widgetManager);
if (this._xterm && this._xterm.element) {
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
this._hadFocusOnExit = this._xterm.element.classList.contains('focus');
}
if (this._wrapperElement) {
if (this._wrapperElement.xterm) {