diff options
| author | Priyansh <[email protected]> | 2021-11-28 14:27:57 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-28 14:27:57 -0500 |
| commit | d53094ec16ba385faae2973ddee648698b32ab24 (patch) | |
| tree | 9fe907f4f5a4ed57fff915526f36eca9dd05f07e /js/src/popover.js | |
| parent | 52cd86f8710f8049a744b5bcb9f4a7ce19114b6e (diff) | |
| parent | 5290080d4df3047d04c8a232bca5dc7f8eaa4bc6 (diff) | |
| download | bootstrap-d53094ec16ba385faae2973ddee648698b32ab24.tar.xz bootstrap-d53094ec16ba385faae2973ddee648698b32ab24.zip | |
Merge branch 'twbs:main' into main
Diffstat (limited to 'js/src/popover.js')
| -rw-r--r-- | js/src/popover.js | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/js/src/popover.js b/js/src/popover.js index d499bedf1..19c1e42a4 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.2): popover.js + * Bootstrap (v5.1.3): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -9,15 +9,15 @@ import { defineJQueryPlugin } from './util/index' import Tooltip from './tooltip' /** - * ------------------------------------------------------------------------ * Constants - * ------------------------------------------------------------------------ */ const NAME = 'popover' const DATA_KEY = 'bs.popover' const EVENT_KEY = `.${DATA_KEY}` -const CLASS_PREFIX = 'bs-popover' + +const SELECTOR_TITLE = '.popover-header' +const SELECTOR_CONTENT = '.popover-body' const Default = { ...Tooltip.Default, @@ -50,18 +50,12 @@ const Event = { MOUSELEAVE: `mouseleave${EVENT_KEY}` } -const SELECTOR_TITLE = '.popover-header' -const SELECTOR_CONTENT = '.popover-body' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ + * Class definition */ class Popover extends Tooltip { // Getters - static get Default() { return Default } @@ -79,28 +73,23 @@ class Popover extends Tooltip { } // Overrides - isWithContent() { return this.getTitle() || this._getContent() } - setContent(tip) { - this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE) - this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT) - } - // Private + _getContentForTemplate() { + return { + [SELECTOR_TITLE]: this.getTitle(), + [SELECTOR_CONTENT]: this._getContent() + } + } _getContent() { return this._resolvePossibleFunction(this._config.content) } - _getBasicClassPrefix() { - return CLASS_PREFIX - } - // Static - static jQueryInterface(config) { return this.each(function () { const data = Popover.getOrCreateInstance(this, config) @@ -117,10 +106,7 @@ class Popover extends Tooltip { } /** - * ------------------------------------------------------------------------ * jQuery - * ------------------------------------------------------------------------ - * add .Popover to jQuery only if jQuery is present */ defineJQueryPlugin(Popover) |
