diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-07-03 11:54:51 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-03 11:54:51 -0400 | 
| commit | 0279d002741d22cacacb9f15897aebf1f953908c (patch) | |
| tree | 3c8af5a3e5891f177b9cd5cd2ca6b0f9cdfa3e1a /ext | |
| parent | af4dc49074eb0431090b10ab0e8d7bdd8c605963 (diff) | |
Don't use/assign popup private fields without using "this" (#635)
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/fg/js/popup.js | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 931813de..f9305bcd 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -122,8 +122,8 @@ class Popup {      }      async containsPoint(x, y) { -        for (let popup = this; popup !== null && popup.isVisibleSync(); popup = popup._child) { -            const rect = popup._frame.getBoundingClientRect(); +        for (let popup = this; popup !== null && popup.isVisibleSync(); popup = popup.child) { +            const rect = popup.getFrameRect();              if (x >= rect.left && y >= rect.top && x < rect.right && y < rect.bottom) {                  return true;              } @@ -166,11 +166,15 @@ class Popup {          if (this._parent !== null) {              throw new Error('Popup already has a parent');          } -        if (parent._child !== null) { -            throw new Error('Cannot parent popup to another popup which already has a child'); -        } +        parent.setChild(this);          this._parent = parent; -        parent._child = this; +    } + +    setChild(popup) { +        if (this._child !== null) { +            throw new Error('Popup already has a child'); +        } +        this._child = popup;      }      isVisibleSync() { |