Skip to content

Commit d12593d

Browse files
cmpilatovalorkin
authored andcommitted
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.
1 parent c172423 commit d12593d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/positioning/ng-positioning.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ export class Positioning {
1212
let parentOffset: ClientRect = {width: 0, height: 0, top: 0, bottom: 0, left: 0, right: 0};
1313

1414
if (this.getStyle(element, 'position') === 'fixed') {
15-
elPosition = element.getBoundingClientRect();
15+
const bcRect = element.getBoundingClientRect();
16+
elPosition = {
17+
width: bcRect.width,
18+
height: bcRect.height,
19+
top: bcRect.top,
20+
bottom: bcRect.bottom,
21+
left: bcRect.left,
22+
right: bcRect.right
23+
};
1624
} else {
1725
const offsetParentEl = this.offsetParent(element);
1826

0 commit comments

Comments
 (0)