From 0bf9449ee1f9b2498e35f61511cb3e018814c6ca Mon Sep 17 00:00:00 2001 From: Evgeniy Date: Wed, 10 Jun 2020 19:03:37 +0300 Subject: [PATCH] fix(img): use setTimeout fallback on older versions of chrome (#21358) --- core/src/components/img/img.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/components/img/img.tsx b/core/src/components/img/img.tsx index 1f6977a7f7..80947ea17c 100644 --- a/core/src/components/img/img.tsx +++ b/core/src/components/img/img.tsx @@ -53,7 +53,11 @@ export class Img implements ComponentInterface { if (this.src === undefined) { return; } - if ('IntersectionObserver' in window) { + if ( + typeof (window as any) !== 'undefined' && + 'IntersectionObserver' in window && + 'IntersectionObserverEntry' in window && + 'isIntersecting' in window.IntersectionObserverEntry.prototype) { this.removeIO(); this.io = new IntersectionObserver(data => { // because there will only ever be one instance