Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-06-10 17:56:43 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-07-22 17:54:48 +0300
commit3533e2d637d694b5b11a65c7911c3dc45d131e42 (patch)
tree7a6d7a3a18ccab26d661ed411dcf4a2738b45351 /js/src/dropdown.js
parentd3c6f25fd0cc811a681f3a6b88708c04b2c9b797 (diff)
Merge `dropdownInterface` to `jQueryInterface`
Diffstat (limited to 'js/src/dropdown.js')
-rw-r--r--js/src/dropdown.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index d9bd903c18..09414c97be 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -371,21 +371,19 @@ class Dropdown extends BaseComponent {
// Static
- static dropdownInterface(element, config) {
- const data = Dropdown.getOrCreateInstance(element, config)
+ static jQueryInterface(config) {
+ return this.each(function () {
+ const data = Dropdown.getOrCreateInstance(this, config)
+
+ if (typeof config !== 'string') {
+ return
+ }
- if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
- }
- }
-
- static jQueryInterface(config) {
- return this.each(function () {
- Dropdown.dropdownInterface(this, config)
})
}
@@ -503,7 +501,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault()
- Dropdown.dropdownInterface(this)
+ Dropdown.getOrCreateInstance(this)
})
/**