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-12-10 19:18:18 +0300
committerGitHub <noreply@github.com>2021-12-10 19:18:18 +0300
commit886b940796b3595a03b44230ca8b78197c5ee1c5 (patch)
tree6b37d0208ae9fd9816e052572ab3496095cc88b6 /js/src/modal.js
parent68f226750db03bc26ed5ead6bb074804a4f63853 (diff)
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'js/src/modal.js')
-rw-r--r--js/src/modal.js27
1 files changed, 6 insertions, 21 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index b8b1447746..569e6e5902 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -5,16 +5,8 @@
* --------------------------------------------------------------------------
*/
-import {
- defineJQueryPlugin,
- getElementFromSelector,
- isRTL,
- isVisible,
- reflow,
- typeCheckConfig
-} from './util/index'
+import { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index'
import EventHandler from './dom/event-handler'
-import Manipulator from './dom/manipulator'
import SelectorEngine from './dom/selector-engine'
import ScrollBarHelper from './util/scrollbar'
import BaseComponent from './base-component'
@@ -70,9 +62,8 @@ const DefaultType = {
class Modal extends BaseComponent {
constructor(element, config) {
- super(element)
+ super(element, config)
- this._config = this._getConfig(config)
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)
this._backdrop = this._initializeBackDrop()
this._focustrap = this._initializeFocusTrap()
@@ -86,6 +77,10 @@ class Modal extends BaseComponent {
return Default
}
+ static get DefaultType() {
+ return DefaultType
+ }
+
static get NAME() {
return NAME
}
@@ -175,16 +170,6 @@ class Modal extends BaseComponent {
})
}
- _getConfig(config) {
- config = {
- ...Default,
- ...Manipulator.getDataAttributes(this._element),
- ...(typeof config === 'object' ? config : {})
- }
- typeCheckConfig(NAME, config, DefaultType)
- return config
- }
-
_showElement(relatedTarget) {
// try to append dynamic modal
if (!document.body.contains(this._element)) {