From d12593de2becf9dc206ac10261c46ece18219018 Mon Sep 17 00:00:00 2001 From: "C. Michael Pilato" Date: Mon, 12 Jun 2017 09:45:36 -0400 Subject: [PATCH] fix(positioning): don't modify readonly value (#2042) (Positioning.position): element.getBoundingClientRect() returns a read-only value, so don't assign it directly to a variable whose properties are subsequently modified. --- src/positioning/ng-positioning.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/positioning/ng-positioning.ts b/src/positioning/ng-positioning.ts index 9fcf9a754c..f383029d48 100644 --- a/src/positioning/ng-positioning.ts +++ b/src/positioning/ng-positioning.ts @@ -12,7 +12,15 @@ export class Positioning { let parentOffset: ClientRect = {width: 0, height: 0, top: 0, bottom: 0, left: 0, right: 0}; if (this.getStyle(element, 'position') === 'fixed') { - elPosition = element.getBoundingClientRect(); + const bcRect = element.getBoundingClientRect(); + elPosition = { + width: bcRect.width, + height: bcRect.height, + top: bcRect.top, + bottom: bcRect.bottom, + left: bcRect.left, + right: bcRect.right + }; } else { const offsetParentEl = this.offsetParent(element);