From f35dbb99b5e41fd3c84f238da8671ed4741b0cd0 Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Thu, 21 May 2015 11:50:04 +0200 Subject: [PATCH] fix(browser_adapter): element.getBoundingClientRect fails when element not in DOM (IE11) --- modules/angular2/src/dom/browser_adapter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/dom/browser_adapter.ts b/modules/angular2/src/dom/browser_adapter.ts index 81f9b4e94f..181e6a9a26 100644 --- a/modules/angular2/src/dom/browser_adapter.ts +++ b/modules/angular2/src/dom/browser_adapter.ts @@ -270,7 +270,11 @@ defaultDoc() { return document; } getBoundingClientRect(el) { - return el.getBoundingClientRect(); + try { + return el.getBoundingClientRect(); + } catch (e) { + return {top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0}; + } } getTitle(): string { return document.title;