aboutsummaryrefslogtreecommitdiff
path: root/js/src/tab.js
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-06-03 18:53:27 +0300
committerGitHub <[email protected]>2021-06-03 18:53:27 +0300
commitc98657b8303150bfda3bdea750055b83a29b27a3 (patch)
tree6f7b347461e3fdd380f0d4e990440e6fc427af61 /js/src/tab.js
parent4a5029ea29ac75243dfec68153051292fc70f5cf (diff)
downloadbootstrap-c98657b8303150bfda3bdea750055b83a29b27a3.tar.xz
bootstrap-c98657b8303150bfda3bdea750055b83a29b27a3.zip
Add `getOrCreateInstance` method in base-component (#33276)
Co-authored-by: Rohit Sharma <[email protected]> Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src/tab.js')
-rw-r--r--js/src/tab.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/js/src/tab.js b/js/src/tab.js
index 51deb170f..6de48e4cd 100644
--- a/js/src/tab.js
+++ b/js/src/tab.js
@@ -11,7 +11,6 @@ import {
isDisabled,
reflow
} from './util/index'
-import Data from './dom/data'
import EventHandler from './dom/event-handler'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
@@ -181,7 +180,7 @@ class Tab extends BaseComponent {
static jQueryInterface(config) {
return this.each(function () {
- const data = Data.get(this, DATA_KEY) || new Tab(this)
+ const data = Tab.getOrCreateInstance(this)
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
@@ -209,7 +208,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
return
}
- const data = Data.get(this, DATA_KEY) || new Tab(this)
+ const data = Tab.getOrCreateInstance(this)
data.show()
})