From dbc14502e71102626461b93139c65bf91a026ce3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sun, 29 Mar 2020 19:54:25 +0200 Subject: [PATCH] Minor tweaks --- src/vs/editor/browser/config/elementSizeObserver.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/browser/config/elementSizeObserver.ts b/src/vs/editor/browser/config/elementSizeObserver.ts index 09095533d0b..06b42c6f9c6 100644 --- a/src/vs/editor/browser/config/elementSizeObserver.ts +++ b/src/vs/editor/browser/config/elementSizeObserver.ts @@ -48,8 +48,8 @@ export class ElementSizeObserver extends Disposable { this.width = -1; this.height = -1; this.resizeObserver = null; - this.measureReferenceDomElement(false, dimension); this.measureReferenceDomElementToken = -1; + this.measureReferenceDomElement(false, dimension); } public dispose(): void { @@ -69,7 +69,7 @@ export class ElementSizeObserver extends Disposable { if (typeof ResizeObserver !== 'undefined') { if (!this.resizeObserver && this.referenceDomElement) { this.resizeObserver = new ResizeObserver((entries) => { - if (entries && entries[0]) { + if (entries && entries[0] && entries[0].contentRect) { this.observe({ width: entries[0].contentRect.width, height: entries[0].contentRect.height }); } else { this.observe(); @@ -80,7 +80,7 @@ export class ElementSizeObserver extends Disposable { } else { if (this.measureReferenceDomElementToken === -1) { // setInterval type defaults to NodeJS.Timeout instead of number, so specify it as a number - this.measureReferenceDomElementToken = setInterval(() => this.observe(), 100) as unknown as number; + this.measureReferenceDomElementToken = setInterval(() => this.observe(), 100); } } } -- GitLab