1
0
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:
Johann-S
2018-06-24 22:02:03 +02:00
committed by XhmikosR
parent 5dcca44fcf
commit 467dd113c5
8 changed files with 19 additions and 15 deletions

View File

@@ -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)
}
}
/**