diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/popover.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/popover.js | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/popover.js b/vendor/twbs/bootstrap/js/dist/popover.js index 3524c31a2..0fc0ec4b7 100644 --- a/vendor/twbs/bootstrap/js/dist/popover.js +++ b/vendor/twbs/bootstrap/js/dist/popover.js @@ -1,18 +1,17 @@ /*! - * Bootstrap popover.js v5.0.1 (https://getbootstrap.com/) + * Bootstrap popover.js v5.0.2 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./tooltip.js')) : - typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './tooltip'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Data, global.Tooltip)); -}(this, (function (SelectorEngine, Data, Tooltip) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./tooltip.js')) : + typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './tooltip'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Tooltip)); +}(this, (function (SelectorEngine, Tooltip) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); - var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data); var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip); const getjQuery = () => { @@ -27,9 +26,18 @@ return null; }; + const DOMContentLoadedCallbacks = []; + const onDOMContentLoaded = callback => { if (document.readyState === 'loading') { - document.addEventListener('DOMContentLoaded', callback); + // add listener on the first call when the document is in loading state + if (!DOMContentLoadedCallbacks.length) { + document.addEventListener('DOMContentLoaded', () => { + DOMContentLoadedCallbacks.forEach(callback => callback()); + }); + } + + DOMContentLoadedCallbacks.push(callback); } else { callback(); } @@ -56,7 +64,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.1): popover.js + * Bootstrap (v5.0.2): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -126,6 +134,24 @@ return this.getTitle() || this._getContent(); } + getTipElement() { + if (this.tip) { + return this.tip; + } + + this.tip = super.getTipElement(); + + if (!this.getTitle()) { + SelectorEngine__default['default'].findOne(SELECTOR_TITLE, this.tip).remove(); + } + + if (!this._getContent()) { + SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, this.tip).remove(); + } + + return this.tip; + } + setContent() { const tip = this.getTipElement(); // we use append for html objects to maintain js events @@ -162,18 +188,7 @@ static jQueryInterface(config) { return this.each(function () { - let data = Data__default['default'].get(this, DATA_KEY); - - const _config = typeof config === 'object' ? config : null; - - if (!data && /dispose|hide/.test(config)) { - return; - } - - if (!data) { - data = new Popover(this, _config); - Data__default['default'].set(this, DATA_KEY, data); - } + const data = Popover.getOrCreateInstance(this, config); if (typeof config === 'string') { if (typeof data[config] === 'undefined') { |