Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace dom helper with HTMLElement.remove() #4364

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions addons/xterm-addon-canvas/src/BaseRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @license MIT
*/

import { removeElementFromParent } from 'browser/Dom';
import { acquireTextureAtlas } from 'browser/renderer/shared/CharAtlasCache';
import { TEXT_BASELINE } from 'browser/renderer/shared/Constants';
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
Expand Down Expand Up @@ -74,7 +73,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
}));

this.register(toDisposable(() => {
removeElementFromParent(this._canvas);
this._canvas.remove();
this._charAtlas?.dispose();
}));
}
Expand Down
5 changes: 2 additions & 3 deletions src/browser/AccessibilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { addDisposableDomListener } from 'browser/Lifecycle';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { ScreenDprMonitor } from 'browser/ScreenDprMonitor';
import { IRenderService } from 'browser/services/Services';
import { removeElementFromParent } from 'browser/Dom';

const MAX_ROWS_TO_READ = 20;

Expand Down Expand Up @@ -105,7 +104,7 @@ export class AccessibilityManager extends Disposable {
// media query that drives the ScreenDprMonitor isn't supported
this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions()));
this.register(toDisposable(() => {
removeElementFromParent(this._accessibilityTreeRoot);
this._accessibilityTreeRoot.remove();
this._rowElements.length = 0;
}));
}
Expand Down Expand Up @@ -240,7 +239,7 @@ export class AccessibilityManager extends Disposable {

// Only detach/attach on mac as otherwise messages can go unaccounced
if (isMac) {
removeElementFromParent(this._liveRegion);
this._liveRegion.remove();
}
}

Expand Down
41 changes: 0 additions & 41 deletions src/browser/Dom.test.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/browser/Dom.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/browser/renderer/dom/DomRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @license MIT
*/

import { removeElementFromParent } from 'browser/Dom';
import { BOLD_CLASS, CURSOR_BLINK_CLASS, CURSOR_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory, ITALIC_CLASS } from 'browser/renderer/dom/DomRendererRowFactory';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
Expand Down Expand Up @@ -87,7 +86,10 @@ export class DomRenderer extends Disposable implements IRenderer {

// Outside influences such as React unmounts may manipulate the DOM before our disposal.
// https://github.com/xtermjs/xterm.js/issues/2960
removeElementFromParent(this._rowContainer, this._selectionContainer, this._themeStyleElement, this._dimensionsStyleElement);
this._rowContainer.remove();
this._selectionContainer.remove();
this._themeStyleElement.remove();
this._dimensionsStyleElement.remove();
}));
}

Expand Down
2 changes: 1 addition & 1 deletion typings/xterm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ declare module 'xterm' {
* @param range The buffer range of the link.
*/
leave?(event: MouseEvent, text: string, range: IBufferRange): void;

/**
* Whether to receive non-HTTP URLs from LinkProvider. When false, any usage of non-HTTP URLs
* will be ignored. Enabling this option without proper protection in `activate` function
Expand Down