diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-12-10 19:18:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 19:18:18 +0300 |
commit | 886b940796b3595a03b44230ca8b78197c5ee1c5 (patch) | |
tree | 6b37d0208ae9fd9816e052572ab3496095cc88b6 /js/src/tooltip.js | |
parent | 68f226750db03bc26ed5ead6bb074804a4f63853 (diff) |
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r-- | js/src/tooltip.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 19a9b31685..9c8e54c66b 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -12,8 +12,7 @@ import { getElement, getUID, isRTL, - noop, - typeCheckConfig + noop } from './util/index' import { DefaultAllowlist } from './util/sanitizer' import EventHandler from './dom/event-handler' @@ -140,6 +139,10 @@ class Tooltip extends BaseComponent { return Default } + static get DefaultType() { + return DefaultType + } + static get NAME() { return NAME } @@ -148,10 +151,6 @@ class Tooltip extends BaseComponent { return Event } - static get DefaultType() { - return DefaultType - } - // Public enable() { this._isEnabled = true @@ -571,11 +570,16 @@ class Tooltip extends BaseComponent { } config = { - ...this.constructor.Default, ...dataAttributes, ...(typeof config === 'object' && config ? config : {}) } + config = this._mergeConfigObj(config) + config = this._configAfterMerge(config) + this._typeCheckConfig(config) + return config + } + _configAfterMerge(config) { config.container = config.container === false ? document.body : getElement(config.container) if (typeof config.delay === 'number') { @@ -595,7 +599,6 @@ class Tooltip extends BaseComponent { config.content = config.content.toString() } - typeCheckConfig(NAME, config, this.constructor.DefaultType) return config } |