aboutsummaryrefslogtreecommitdiff
path: root/js/src/alert.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/alert.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/alert.js')
-rw-r--r--js/src/alert.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/js/src/alert.js b/js/src/alert.js
index 679a90cdb..e5e5e2a5d 100644
--- a/js/src/alert.js
+++ b/js/src/alert.js
@@ -9,7 +9,6 @@ import {
defineJQueryPlugin,
getElementFromSelector
} from './util/index'
-import Data from './dom/data'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
@@ -87,11 +86,7 @@ class Alert extends BaseComponent {
static jQueryInterface(config) {
return this.each(function () {
- let data = Data.get(this, DATA_KEY)
-
- if (!data) {
- data = new Alert(this)
- }
+ const data = Alert.getOrCreateInstance(this)
if (config === 'close') {
data[config](this)