aboutsummaryrefslogtreecommitdiff
path: root/js/src/dropdown.js
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-10 18:18:18 +0200
committerGitHub <[email protected]>2021-12-10 18:18:18 +0200
commit886b940796b3595a03b44230ca8b78197c5ee1c5 (patch)
tree6b37d0208ae9fd9816e052572ab3496095cc88b6 /js/src/dropdown.js
parent68f226750db03bc26ed5ead6bb074804a4f63853 (diff)
downloadbootstrap-886b940796b3595a03b44230ca8b78197c5ee1c5.tar.xz
bootstrap-886b940796b3595a03b44230ca8b78197c5ee1c5.zip
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src/dropdown.js')
-rw-r--r--js/src/dropdown.js14
1 files changed, 3 insertions, 11 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index c4e7baf29..674150e01 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -15,8 +15,7 @@ import {
isElement,
isRTL,
isVisible,
- noop,
- typeCheckConfig
+ noop
} from './util/index'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
@@ -88,10 +87,9 @@ const DefaultType = {
class Dropdown extends BaseComponent {
constructor(element, config) {
- super(element)
+ super(element, config)
this._popper = null
- this._config = this._getConfig(config)
this._menu = this._getMenuElement()
this._inNavbar = this._detectNavbar()
}
@@ -205,13 +203,7 @@ class Dropdown extends BaseComponent {
}
_getConfig(config) {
- config = {
- ...this.constructor.Default,
- ...Manipulator.getDataAttributes(this._element),
- ...config
- }
-
- typeCheckConfig(NAME, config, this.constructor.DefaultType)
+ config = super._getConfig(config)
if (typeof config.reference === 'object' && !isElement(config.reference) &&
typeof config.reference.getBoundingClientRect !== 'function'