2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-05-24 14:04:09 +03:00

Cache a few variables.

This commit is contained in:
XhmikosR
2020-07-08 20:09:39 +03:00
parent c86b74fe88
commit b31046aab3
4 changed files with 12 additions and 9 deletions
+3 -2
View File
@@ -111,11 +111,12 @@ class Button {
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const $element = $(this)
let data = $element.data(DATA_KEY)
if (!data) {
data = new Button(this)
$(this).data(DATA_KEY, data)
$element.data(DATA_KEY, data)
}
if (config === 'toggle') {