diff options
| author | GeoSot <[email protected]> | 2022-10-07 15:25:00 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-07 15:25:00 +0300 |
| commit | 4cb046a6b8b37a0f328fa5b86fbd573ca3f0dc33 (patch) | |
| tree | e4ed791f3cfbe938308095ef1f4d123c72a323a2 /js/src/tooltip.js | |
| parent | 708a3a0e398f6c01f00283941cd6a4aca9f66322 (diff) | |
| download | bootstrap-4cb046a6b8b37a0f328fa5b86fbd573ca3f0dc33.tar.xz bootstrap-4cb046a6b8b37a0f328fa5b86fbd573ca3f0dc33.zip | |
Boost `execute` function, being able to handle arguments (#36652)
Diffstat (limited to 'js/src/tooltip.js')
| -rw-r--r-- | js/src/tooltip.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 70198c81b..a3f3377c0 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -6,7 +6,7 @@ */ import * as Popper from '@popperjs/core' -import { defineJQueryPlugin, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index' +import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index' import { DefaultAllowlist } from './util/sanitizer' import EventHandler from './dom/event-handler' import Manipulator from './dom/manipulator' @@ -370,9 +370,7 @@ class Tooltip extends BaseComponent { } _createPopper(tip) { - const placement = typeof this._config.placement === 'function' ? - this._config.placement.call(this, tip, this._element) : - this._config.placement + const placement = execute(this._config.placement, [this, tip, this._element]) const attachment = AttachmentMap[placement.toUpperCase()] return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment)) } @@ -392,7 +390,7 @@ class Tooltip extends BaseComponent { } _resolvePossibleFunction(arg) { - return typeof arg === 'function' ? arg.call(this._element) : arg + return execute(arg, [this._element]) } _getPopperConfig(attachment) { @@ -438,7 +436,7 @@ class Tooltip extends BaseComponent { return { ...defaultBsPopperConfig, - ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) + ...execute(this._config.popperConfig, [defaultBsPopperConfig]) } } |
