Skip to content

Commit f35dbb9

Browse files
committed
fix(browser_adapter): element.getBoundingClientRect fails when element not in DOM (IE11)
1 parent a393f84 commit f35dbb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/angular2/src/dom/browser_adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ defaultDoc() {
270270
return document;
271271
}
272272
getBoundingClientRect(el) {
273-
return el.getBoundingClientRect();
273+
try {
274+
return el.getBoundingClientRect();
275+
} catch (e) {
276+
return {top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0};
277+
}
274278
}
275279
getTitle(): string {
276280
return document.title;

0 commit comments

Comments
 (0)