1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-07 14:16:47 +02:00

Remove element event listeners through base component (#33429)

After some research, I found out that EventHandler saves all the custom events per element using namespace, and is capable of removing handlers using only the element and its namespace (`DATA_KEY`).

So, probably is better to utilize the base-component to do the same job.
This commit is contained in:
GeoSot
2021-04-11 09:54:48 +03:00
committed by GitHub
parent bac0b0c899
commit 566451230f
6 changed files with 3 additions and 7 deletions

View File

@@ -6,6 +6,7 @@
*/
import Data from './dom/data'
import EventHandler from './dom/event-handler'
/**
* ------------------------------------------------------------------------
@@ -29,6 +30,7 @@ class BaseComponent {
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY)
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`)
this._element = null
}