mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-07 14:16:47 +02:00
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 .
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user