Skip to content

Commit

Permalink
Merge pull request #2450 from Tyriar/1158_throw_bad_open
Browse files Browse the repository at this point in the history
Throw when open is called on element not on DOM
  • Loading branch information
Tyriar committed Oct 7, 2019
2 parents e14b1f7 + 52ae8fc commit 4fde8db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/public/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4fde8db

Please sign in to comment.