diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-05-11 09:04:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 09:04:42 +0300 |
commit | 03842b5f259d6007db02c465e6c55929e551e9cd (patch) | |
tree | b5ec0345127f40dd0918ef6828c3057ca57a4c3a /js/src/base-component.js | |
parent | 052def456845c2147e4e6c99d17bba12fcbee34c (diff) |
Refactor: move disposing properties into the base class (#33740)
Moves more functionality to `base-component`, transferring the responsibility of disposal to parent class.
Each component, dusting disposal, sets its protected properties to `null`. So the same can be done in one place for all children components .
Diffstat (limited to 'js/src/base-component.js')
-rw-r--r-- | js/src/base-component.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/src/base-component.js b/js/src/base-component.js index 7d2a5b1e87..588a59d756 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -36,7 +36,10 @@ class BaseComponent { dispose() { Data.remove(this._element, this.constructor.DATA_KEY) EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`) - this._element = null + + Object.getOwnPropertyNames(this).forEach(propertyName => { + this[propertyName] = null + }) } _queueCallback(callback, element, isAnimated = true) { |