From 6a7901748406890bf1bdc8d29b30763c6eb76ce6 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 9 Feb 2022 14:33:33 -0600 Subject: [PATCH] on dispose, remove container --- src/browser/services/DecorationService.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 08e8e9c7..4073b03c 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -13,6 +13,7 @@ export class DecorationService extends Disposable implements IDecorationService private readonly _decorations: Decoration[] = []; private _container: HTMLElement | undefined; + private _screenElement: HTMLElement | undefined; private _renderService: IRenderService | undefined; private _bufferService: IBufferService | undefined; @@ -24,6 +25,7 @@ export class DecorationService extends Disposable implements IDecorationService public attachToDom(screenElement: HTMLElement, renderService: IRenderService, bufferService: IBufferService): void { this._renderService = renderService; this._bufferService = bufferService; + this._screenElement = screenElement; this._container = document.createElement('div'); this._container.classList.add('xterm-decoration-container'); screenElement.appendChild(this._container); @@ -55,6 +57,9 @@ export class DecorationService extends Disposable implements IDecorationService for (const decoration of this._decorations) { decoration.dispose(); } + if (this._container) { + this._screenElement?.removeChild(this._container); + } } } export class Decoration extends Disposable implements IDecoration {