Throw when open is called on element not on DOM

Fixes #1158
This commit is contained in:
Daniel Imms
2019-10-07 10:21:34 -07:00
parent e14b1f75fe
commit 52ae8fc14b
+3
View File
@@ -56,6 +56,9 @@ export class Terminal implements ITerminalApi {
this._core.resize(columns, rows);
}
public open(parent: HTMLElement): void {
if (!document.body.contains(parent)) {
throw new Error('open must be called on an element that is attached to the DOM');
}
this._core.open(parent);
}
public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {