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:
Diffstat (limited to 'js/src/util/template-factory.js')
-rw-r--r--js/src/util/template-factory.js31
1 files changed, 15 insertions, 16 deletions
diff --git a/js/src/util/template-factory.js b/js/src/util/template-factory.js
index a9cee1086c..8a8d4da798 100644
--- a/js/src/util/template-factory.js
+++ b/js/src/util/template-factory.js
@@ -6,8 +6,9 @@
*/
import { DefaultAllowlist, sanitizeHtml } from './sanitizer'
-import { getElement, isElement, typeCheckConfig } from '../util/index'
+import { getElement, isElement } from '../util/index'
import SelectorEngine from '../dom/selector-engine'
+import Config from './config'
/**
* Constants
@@ -44,20 +45,25 @@ const DefaultContentType = {
* Class definition
*/
-class TemplateFactory {
+class TemplateFactory extends Config {
constructor(config) {
+ super()
this._config = this._getConfig(config)
}
// Getters
- static get NAME() {
- return NAME
- }
-
static get Default() {
return Default
}
+ static get DefaultType() {
+ return DefaultType
+ }
+
+ static get NAME() {
+ return NAME
+ }
+
// Public
getContent() {
return Object.values(this._config.content)
@@ -94,21 +100,14 @@ class TemplateFactory {
}
// Private
- _getConfig(config) {
- config = {
- ...Default,
- ...(typeof config === 'object' ? config : {})
- }
-
- typeCheckConfig(NAME, config, DefaultType)
+ _typeCheckConfig(config) {
+ super._typeCheckConfig(config)
this._checkContent(config.content)
-
- return config
}
_checkContent(arg) {
for (const [selector, content] of Object.entries(arg)) {
- typeCheckConfig(NAME, { selector, entry: content }, DefaultContentType)
+ super._typeCheckConfig({ selector, entry: content }, DefaultContentType)
}
}