mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-18 03:11:19 +02:00
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -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'
|
||||
|
Reference in New Issue
Block a user