Skip to content

Commit

Permalink
fix(positioning): don't modify readonly value (#2042)
Browse files Browse the repository at this point in the history
(Positioning.position): element.getBoundingClientRect() returns a read-only value, so don't assign it directly to a variable whose properties are subsequently modified.
  • Loading branch information
cmpilato authored and valorkin committed Jun 12, 2017
1 parent c172423 commit d12593d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/positioning/ng-positioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d12593d

Please sign in to comment.