From 5cfff8d6d35e9a2509aa6495fe8ee9eb96703939 Mon Sep 17 00:00:00 2001 From: pushkin Date: Tue, 13 Oct 2020 11:14:35 +0200 Subject: [PATCH 1/3] Update dom.ts --- src/runtime/internal/dom.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 5380443fbc0a..38ed48fcf513 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -260,6 +260,11 @@ export function is_crossorigin() { } export function add_resize_listener(node: HTMLElement, fn: () => void) { + if ('ResizeObserver' in window) { + const obs = new ResizeObserver(fn); + obs.observe(node); + return obs.disconnect.bind(obs); + } const computed_style = getComputedStyle(node); const z_index = (parseInt(computed_style.zIndex) || 0) - 1; From 23d936705de77c2d01e84a32fbbd66c15e1cb62d Mon Sep 17 00:00:00 2001 From: pushkin Date: Tue, 13 Oct 2020 11:31:36 +0200 Subject: [PATCH 2/3] Update dom.ts --- src/runtime/internal/dom.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 38ed48fcf513..2d9ec08e1b30 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -261,7 +261,7 @@ export function is_crossorigin() { export function add_resize_listener(node: HTMLElement, fn: () => void) { if ('ResizeObserver' in window) { - const obs = new ResizeObserver(fn); + const obs = new ResizeObserver(fn) as any; obs.observe(node); return obs.disconnect.bind(obs); } From 6989450ccdd650d52ac6daaee581bf2f2bad2611 Mon Sep 17 00:00:00 2001 From: pushkin Date: Tue, 13 Oct 2020 11:37:04 +0200 Subject: [PATCH 3/3] Update dom.ts --- src/runtime/internal/dom.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 2d9ec08e1b30..1e12c31e683a 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -261,6 +261,7 @@ export function is_crossorigin() { export function add_resize_listener(node: HTMLElement, fn: () => void) { if ('ResizeObserver' in window) { + // @ts-ignore https://github.com/Microsoft/TypeScript/issues/28502 const obs = new ResizeObserver(fn) as any; obs.observe(node); return obs.disconnect.bind(obs);