mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-27 05:49:07 +02:00
fix(plugins): save instance in constructor
This commit is contained in:
@@ -52,6 +52,7 @@ const Event = {
|
||||
class Button {
|
||||
constructor(element) {
|
||||
this._element = element
|
||||
Data.setData(element, DATA_KEY, this)
|
||||
}
|
||||
|
||||
// Getters
|
||||
@@ -112,10 +113,6 @@ class Button {
|
||||
if (triggerChangeEvent) {
|
||||
this._element.classList.toggle(ClassName.ACTIVE)
|
||||
}
|
||||
|
||||
static _getInstance(element) {
|
||||
return Data.getData(element, DATA_KEY)
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
@@ -131,7 +128,6 @@ class Button {
|
||||
|
||||
if (!data) {
|
||||
data = new Button(this)
|
||||
Data.setData(this, DATA_KEY, data)
|
||||
}
|
||||
|
||||
if (config === 'toggle') {
|
||||
@@ -139,6 +135,10 @@ class Button {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static _getInstance(element) {
|
||||
return Data.getData(element, DATA_KEY)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user