From 4f0cc01485247f3376cfab8d2dbe3626202ecc90 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 9 Mar 2018 11:23:45 -0800 Subject: [PATCH 1/3] Fix strictNullChecks errors in AccessibilityManager Part of #1319 --- src/AccessibilityManager.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/AccessibilityManager.ts b/src/AccessibilityManager.ts index 67031cb7..1df6a7d2 100644 --- a/src/AccessibilityManager.ts +++ b/src/AccessibilityManager.ts @@ -20,7 +20,7 @@ enum BoundaryPosition { export class AccessibilityManager implements IDisposable { private _accessibilityTreeRoot: HTMLElement; private _rowContainer: HTMLElement; - private _rowElements: HTMLElement[] = []; + private _rowElements: HTMLElement[]; private _liveRegion: HTMLElement; private _liveRegionLineCount: number = 0; @@ -48,6 +48,7 @@ export class AccessibilityManager implements IDisposable { this._rowContainer = document.createElement('div'); this._rowContainer.classList.add('xterm-accessibility-tree'); + this._rowElements = []; for (let i = 0; i < this._terminal.rows; i++) { this._rowElements[i] = this._createAccessibilityTreeNode(); this._rowContainer.appendChild(this._rowElements[i]); @@ -92,14 +93,10 @@ export class AccessibilityManager implements IDisposable { } public dispose(): void { - this._terminal.element.removeChild(this._accessibilityTreeRoot); this._disposables.forEach(d => d.dispose()); - this._disposables = null; - this._accessibilityTreeRoot = null; - this._rowContainer = null; - this._liveRegion = null; - this._rowContainer = null; - this._rowElements = null; + this._disposables.length = 0; + this._terminal.element.removeChild(this._accessibilityTreeRoot); + this._rowElements.length = 0; } private _onBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void { @@ -124,10 +121,10 @@ export class AccessibilityManager implements IDisposable { let bottomBoundaryElement: HTMLElement; if (position === BoundaryPosition.Top) { topBoundaryElement = boundaryElement; - bottomBoundaryElement = this._rowElements.pop(); + bottomBoundaryElement = this._rowElements.pop(); this._rowContainer.removeChild(bottomBoundaryElement); } else { - topBoundaryElement = this._rowElements.shift(); + topBoundaryElement = this._rowElements.shift(); bottomBoundaryElement = boundaryElement; this._rowContainer.removeChild(topBoundaryElement); } @@ -173,7 +170,7 @@ export class AccessibilityManager implements IDisposable { } // Shrink rows as required while (this._rowElements.length > rows) { - this._rowContainer.removeChild(this._rowElements.pop()); + this._rowContainer.removeChild(this._rowElements.pop()); } // Add bottom boundary listener @@ -217,7 +214,7 @@ export class AccessibilityManager implements IDisposable { // Only detach/attach on mac as otherwise messages can go unaccounced if (isMac) { - if (this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode) { + if (this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode) { setTimeout(() => { this._accessibilityTreeRoot.appendChild(this._liveRegion); }, 0); From 2f861602c8b2eb3ffedbe85eb3375aab65e661c9 Mon Sep 17 00:00:00 2001 From: Felix <30559812+felixse@users.noreply.github.com> Date: Sat, 10 Mar 2018 23:27:59 +0100 Subject: [PATCH 2/3] Add Fluent Terminal to the list of real-world uses --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a2a50372..26f98382 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ computational environment for Jupyter, supporting interactive data science and s - [**abstruse**](https://github.com/bleenco/abstruse): Abstruse CI is a continuous integration platform based on Node.JS and Docker. - [**Microsoft SQL Operations Studio**](https://github.com/Microsoft/sqlopsstudio): A data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux - [**FreeMAN**](https://github.com/matthew-matvei/freeman): A free, cross-platform file manager for power users +- [**Fluent Terminal**](https://github.com/felixse/FluentTerminal): A terminal emulator based on UWP and web technologies. Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it in our list. From 9905e2aa1de32ce684f03a6f85c082b5509e67cf Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 13 Mar 2018 11:19:51 -0700 Subject: [PATCH 3/3] Add note about third party dependencies Fixes #1328 --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b33d183..4aebdf20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,3 +50,7 @@ By contributing code to xterm.js you holder has explicitly granted the right to use it like this, through a compatible open source license or through a direct agreement with you.) + +### Third party dependencies + +We prefer to not include any non-dev third party dependencies in order to keep our code minimal, performant and secure. If you plan on adding a dependency on a third party library it's a good idea to discuss the need in an issue with the maintainers first.