diff options
Diffstat (limited to 'dist/js/bootstrap.bundle.js')
-rw-r--r-- | dist/js/bootstrap.bundle.js | 362 |
1 files changed, 177 insertions, 185 deletions
diff --git a/dist/js/bootstrap.bundle.js b/dist/js/bootstrap.bundle.js index 091b972eda..d5183e6081 100644 --- a/dist/js/bootstrap.bundle.js +++ b/dist/js/bootstrap.bundle.js @@ -1,5 +1,5 @@ /*! - * Bootstrap v5.2.0-beta1 (https://getbootstrap.com/) + * Bootstrap v5.2.0 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -11,13 +11,13 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/index.js + * Bootstrap (v5.2.0): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const MAX_UID = 1000000; const MILLISECONDS_MULTIPLIER = 1000; - const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) + const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp) const toType = object => { if (object === null || object === undefined) { @@ -326,7 +326,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): dom/event-handler.js + * Bootstrap (v5.2.0): dom/event-handler.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -349,12 +349,12 @@ * Private methods */ - function getUidEvent(element, uid) { + function makeEventUid(element, uid) { return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; } - function getEvent(element) { - const uid = getUidEvent(element); + function getElementEvents(element) { + const uid = makeEventUid(element); element.uidEvent = uid; eventRegistry[uid] = eventRegistry[uid] || {}; return eventRegistry[uid]; @@ -362,7 +362,9 @@ function bootstrapHandler(element, fn) { return function handler(event) { - event.delegateTarget = element; + hydrateObj(event, { + delegateTarget: element + }); if (handler.oneOff) { EventHandler.off(element, event.type, fn); @@ -384,7 +386,9 @@ continue; } - event.delegateTarget = target; + hydrateObj(event, { + delegateTarget: target + }); if (handler.oneOff) { EventHandler.off(element, event.type, selector, fn); @@ -396,20 +400,21 @@ }; } - function findHandler(events, handler, delegationSelector = null) { - return Object.values(events).find(event => event.originalHandler === handler && event.delegationSelector === delegationSelector); + function findHandler(events, callable, delegationSelector = null) { + return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); } function normalizeParameters(originalTypeEvent, handler, delegationFunction) { - const delegation = typeof handler === 'string'; - const originalHandler = delegation ? delegationFunction : handler; + const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check + + const callable = isDelegated ? delegationFunction : handler || delegationFunction; let typeEvent = getTypeEvent(originalTypeEvent); if (!nativeEvents.has(typeEvent)) { typeEvent = originalTypeEvent; } - return [delegation, originalHandler, typeEvent]; + return [isDelegated, callable, typeEvent]; } function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { @@ -417,13 +422,9 @@ return; } - if (!handler) { - handler = delegationFunction; - delegationFunction = null; - } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position + let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position // this prevents the handler from being dispatched the same way as mouseover or mouseout does - if (originalTypeEvent in customEvents) { const wrapFunction = fn => { return function (event) { @@ -433,31 +434,26 @@ }; }; - if (delegationFunction) { - delegationFunction = wrapFunction(delegationFunction); - } else { - handler = wrapFunction(handler); - } + callable = wrapFunction(callable); } - const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); - const events = getEvent(element); + const events = getElementEvents(element); const handlers = events[typeEvent] || (events[typeEvent] = {}); - const previousFunction = findHandler(handlers, originalHandler, delegation ? handler : null); + const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); if (previousFunction) { previousFunction.oneOff = previousFunction.oneOff && oneOff; return; } - const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); - const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFunction) : bootstrapHandler(element, handler); - fn.delegationSelector = delegation ? handler : null; - fn.originalHandler = originalHandler; + const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); + const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); + fn.delegationSelector = isDelegated ? handler : null; + fn.callable = callable; fn.oneOff = oneOff; fn.uidEvent = uid; handlers[uid] = fn; - element.addEventListener(typeEvent, fn, delegation); + element.addEventListener(typeEvent, fn, isDelegated); } function removeHandler(element, events, typeEvent, handler, delegationSelector) { @@ -477,7 +473,7 @@ for (const handlerKey of Object.keys(storeElementEvent)) { if (handlerKey.includes(namespace)) { const event = storeElementEvent[handlerKey]; - removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); + removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); } } } @@ -502,18 +498,19 @@ return; } - const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const inNamespace = typeEvent !== originalTypeEvent; - const events = getEvent(element); + const events = getElementEvents(element); + const storeElementEvent = events[typeEvent] || {}; const isNamespace = originalTypeEvent.startsWith('.'); - if (typeof originalHandler !== 'undefined') { + if (typeof callable !== 'undefined') { // Simplest case: handler is passed, remove that listener ONLY. - if (!events || !events[typeEvent]) { + if (!Object.keys(storeElementEvent).length) { return; } - removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); + removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); return; } @@ -523,14 +520,12 @@ } } - const storeElementEvent = events[typeEvent] || {}; - for (const keyHandlers of Object.keys(storeElementEvent)) { const handlerKey = keyHandlers.replace(stripUidRegex, ''); if (!inNamespace || originalTypeEvent.includes(handlerKey)) { const event = storeElementEvent[keyHandlers]; - removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); + removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); } } }, @@ -556,21 +551,11 @@ defaultPrevented = jQueryEvent.isDefaultPrevented(); } - const evt = new Event(event, { + let evt = new Event(event, { bubbles, cancelable: true - }); // merge custom information in our event - - if (typeof args !== 'undefined') { - for (const key of Object.keys(args)) { - Object.defineProperty(evt, key, { - get() { - return args[key]; - } - - }); - } - } + }); + evt = hydrateObj(evt, args); if (defaultPrevented) { evt.preventDefault(); @@ -589,9 +574,28 @@ }; + function hydrateObj(obj, meta) { + for (const [key, value] of Object.entries(meta || {})) { + try { + obj[key] = value; + } catch (_unused) { + Object.defineProperty(obj, key, { + configurable: true, + + get() { + return value; + } + + }); + } + } + + return obj; + } + /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): dom/data.js + * Bootstrap (v5.2.0): dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -643,7 +647,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): dom/manipulator.js + * Bootstrap (v5.2.0): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -713,7 +717,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/config.js + * Bootstrap (v5.2.0): util/config.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -774,7 +778,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): base-component.js + * Bootstrap (v5.2.0): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -782,7 +786,7 @@ * Constants */ - const VERSION = '5.2.0-beta1'; + const VERSION = '5.2.0'; /** * Class definition */ @@ -853,7 +857,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/component-functions.js + * Bootstrap (v5.2.0): util/component-functions.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -879,7 +883,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): alert.js + * Bootstrap (v5.2.0): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -959,7 +963,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): button.js + * Bootstrap (v5.2.0): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1021,7 +1025,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): dom/selector-engine.js + * Bootstrap (v5.2.0): dom/selector-engine.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1092,7 +1096,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/swipe.js + * Bootstrap (v5.2.0): util/swipe.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1112,14 +1116,14 @@ const CLASS_NAME_POINTER_EVENT = 'pointer-event'; const SWIPE_THRESHOLD = 40; const Default$c = { + endCallback: null, leftCallback: null, - rightCallback: null, - endCallback: null + rightCallback: null }; const DefaultType$c = { + endCallback: '(function|null)', leftCallback: '(function|null)', - rightCallback: '(function|null)', - endCallback: '(function|null)' + rightCallback: '(function|null)' }; /** * Class definition @@ -1228,7 +1232,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): carousel.js + * Bootstrap (v5.2.0): carousel.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1284,9 +1288,10 @@ }; const DefaultType$b = { interval: '(number|boolean)', + // TODO:v6 remove boolean support keyboard: 'boolean', - ride: '(boolean|string)', pause: '(string|boolean)', + ride: '(boolean|string)', touch: 'boolean', wrap: 'boolean' }; @@ -1675,7 +1680,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): collapse.js + * Bootstrap (v5.2.0): collapse.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1703,12 +1708,12 @@ const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; const Default$a = { - toggle: true, - parent: null + parent: null, + toggle: true }; const DefaultType$a = { - toggle: 'boolean', - parent: '(null|element)' + parent: '(null|element)', + toggle: 'boolean' }; /** * Class definition @@ -3800,7 +3805,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): dropdown.js + * Bootstrap (v5.2.0): dropdown.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -3846,20 +3851,20 @@ const PLACEMENT_TOPCENTER = 'top'; const PLACEMENT_BOTTOMCENTER = 'bottom'; const Default$9 = { - offset: [0, 2], + autoClose: true, boundary: 'clippingParents', - reference: 'toggle', display: 'dynamic', + offset: [0, 2], popperConfig: null, - autoClose: true + reference: 'toggle' }; const DefaultType$9 = { - offset: '(array|string|function)', + autoClose: '(boolean|string)', boundary: '(string|element)', - reference: '(string|element|object)', display: 'string', + offset: '(array|string|function)', popperConfig: '(null|object|function)', - autoClose: '(boolean|string)' + reference: '(string|element|object)' }; /** * Class definition @@ -4230,7 +4235,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/scrollBar.js + * Bootstrap (v5.2.0): util/scrollBar.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4349,7 +4354,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/backdrop.js + * Bootstrap (v5.2.0): util/backdrop.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4363,19 +4368,19 @@ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; const Default$8 = { className: 'modal-backdrop', + clickCallback: null, + isAnimated: false, isVisible: true, // if false, we use the backdrop helper without adding any element to the dom - isAnimated: false, - rootElement: 'body', - // give the choice to place backdrop under different elements - clickCallback: null + rootElement: 'body' // give the choice to place backdrop under different elements + }; const DefaultType$8 = { className: 'string', - isVisible: 'boolean', + clickCallback: '(function|null)', isAnimated: 'boolean', - rootElement: '(element|string)', - clickCallback: '(function|null)' + isVisible: 'boolean', + rootElement: '(element|string)' }; /** * Class definition @@ -4495,7 +4500,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/focustrap.js + * Bootstrap (v5.2.0): util/focustrap.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4512,13 +4517,13 @@ const TAB_NAV_FORWARD = 'forward'; const TAB_NAV_BACKWARD = 'backward'; const Default$7 = { - trapElement: null, - // The element to trap focus inside of - autofocus: true + autofocus: true, + trapElement: null // The element to trap focus inside of + }; const DefaultType$7 = { - trapElement: 'element', - autofocus: 'boolean' + autofocus: 'boolean', + trapElement: 'element' }; /** * Class definition @@ -4604,7 +4609,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): modal.js + * Bootstrap (v5.2.0): modal.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4623,7 +4628,7 @@ const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; - const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; + const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; const CLASS_NAME_OPEN = 'modal-open'; @@ -4636,13 +4641,13 @@ const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const Default$6 = { backdrop: true, - keyboard: true, - focus: true + focus: true, + keyboard: true }; const DefaultType$6 = { backdrop: '(boolean|string)', - keyboard: 'boolean', - focus: 'boolean' + focus: 'boolean', + keyboard: 'boolean' }; /** * Class definition @@ -4814,7 +4819,7 @@ this._adjustDialog(); } }); - EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { + EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => { if (event.target !== event.currentTarget) { // click is inside modal-dialog return; @@ -4977,7 +4982,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): offcanvas.js + * Bootstrap (v5.2.0): offcanvas.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5075,7 +5080,7 @@ this._element.classList.add(CLASS_NAME_SHOWING$1); const completeCallBack = () => { - if (!this._config.scroll) { + if (!this._config.scroll || this._config.backdrop) { this._focustrap.activate(); } @@ -5251,7 +5256,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/sanitizer.js + * Bootstrap (v5.2.0): util/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5260,14 +5265,14 @@ /** * A pattern that recognizes a commonly useful subset of URLs that are safe. * - * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts + * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts */ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. * - * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts + * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts */ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; @@ -5356,7 +5361,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): util/template-factory.js + * Bootstrap (v5.2.0): util/template-factory.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5366,27 +5371,27 @@ const NAME$5 = 'TemplateFactory'; const Default$4 = { - extraClass: '', - template: '<div></div>', + allowList: DefaultAllowlist, content: {}, // { selector : text , selector2 : text2 , } + extraClass: '', html: false, sanitize: true, sanitizeFn: null, - allowList: DefaultAllowlist + template: '<div></div>' }; const DefaultType$4 = { - extraClass: '(string|function)', - template: 'string', + allowList: 'object', content: 'object', + extraClass: '(string|function)', html: 'boolean', sanitize: 'boolean', sanitizeFn: '(null|function)', - allowList: 'object' + template: 'string' }; const DefaultContentType = { - selector: '(string|element)', - entry: '(string|element|function|null)' + entry: '(string|element|function|null)', + selector: '(string|element)' }; /** * Class definition @@ -5514,7 +5519,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): tooltip.js + * Bootstrap (v5.2.0): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5552,42 +5557,42 @@ LEFT: isRTL() ? 'right' : 'left' }; const Default$3 = { + allowList: DefaultAllowlist, animation: true, - template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', - trigger: 'hover focus', - title: '', + boundary: 'clippingParents', + container: false, + customClass: '', delay: 0, + fallbackPlacements: ['top', 'right', 'bottom', 'left'], html: false, - selector: false, - placement: 'top', offset: [0, 0], - container: false, - fallbackPlacements: ['top', 'right', 'bottom', 'left'], - boundary: 'clippingParents', - customClass: '', + placement: 'top', + popperConfig: null, sanitize: true, sanitizeFn: null, - allowList: DefaultAllowlist, - popperConfig: null + selector: false, + template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', + title: '', + trigger: 'hover focus' }; const DefaultType$3 = { + allowList: 'object', animation: 'boolean', - template: 'string', - title: '(string|element|function)', - trigger: 'string', + boundary: '(string|element)', + container: '(string|element|boolean)', + customClass: '(string|function)', delay: '(number|object)', + fallbackPlacements: 'array', html: 'boolean', - selector: '(string|boolean)', - placement: '(string|function)', offset: '(array|string|function)', - container: '(string|element|boolean)', - fallbackPlacements: 'array', - boundary: '(string|element)', - customClass: '(string|function)', + placement: '(string|function)', + popperConfig: '(null|object|function)', sanitize: 'boolean', sanitizeFn: '(null|function)', - allowList: 'object', - popperConfig: '(null|object|function)' + selector: '(string|boolean)', + template: 'string', + title: '(string|element|function)', + trigger: 'string' }; /** * Class definition @@ -5606,7 +5611,8 @@ this._isHovered = false; this._activeTrigger = {}; this._popper = null; - this._templateFactory = null; // Protected + this._templateFactory = null; + this._newContent = null; // Protected this.tip = null; @@ -5696,6 +5702,12 @@ if (showEvent.defaultPrevented || !isInTheDom) { return; + } // todo v6 remove this OR make it optional + + + if (this.tip) { + this.tip.remove(); + this.tip = null; } const tip = this._getTipElement(); @@ -5714,7 +5726,7 @@ if (this._popper) { this._popper.update(); } else { - this._createPopper(tip); + this._popper = this._createPopper(tip); } tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra @@ -5800,7 +5812,7 @@ _getTipElement() { if (!this.tip) { - this.tip = this._createTipElement(this._getContentForTemplate()); + this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); } return this.tip; @@ -5828,19 +5840,11 @@ } setContent(content) { - let isShown = false; - - if (this.tip) { - isShown = this._isShown(); - this.tip.remove(); - this.tip = null; - } + this._newContent = content; - this._disposePopper(); - - this.tip = this._createTipElement(content); + if (this._isShown()) { + this._disposePopper(); - if (isShown) { this.show(); } } @@ -5867,7 +5871,7 @@ } _getTitle() { - return this._config.title; + return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle; } // Private @@ -5886,7 +5890,7 @@ _createPopper(tip) { const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; const attachment = AttachmentMap[placement.toUpperCase()]; - this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment)); + return createPopper(this._element, tip, this._getPopperConfig(attachment)); } _getOffset() { @@ -5999,7 +6003,7 @@ return; } - if (!this._element.getAttribute('aria-label') && !this._element.textContent) { + if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) { this._element.setAttribute('aria-label', title); } @@ -6075,7 +6079,6 @@ } config.originalTitle = this._element.getAttribute('title') || ''; - config.title = this._resolvePossibleFunction(config.title) || config.originalTitle; if (typeof config.title === 'number') { config.title = config.title.toString(); @@ -6138,7 +6141,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): popover.js + * Bootstrap (v5.2.0): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6150,11 +6153,11 @@ const SELECTOR_TITLE = '.popover-header'; const SELECTOR_CONTENT = '.popover-body'; const Default$2 = { ...Tooltip.Default, - placement: 'right', - offset: [0, 8], - trigger: 'click', content: '', - template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' + offset: [0, 8], + placement: 'right', + template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>', + trigger: 'click' }; const DefaultType$2 = { ...Tooltip.DefaultType, content: '(null|string|element|function)' @@ -6221,7 +6224,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): scrollspy.js + * Bootstrap (v5.2.0): scrollspy.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6341,7 +6344,8 @@ if (root.scrollTo) { root.scrollTo({ - top: height + top: height, + behavior: 'smooth' }); return; } // Chrome 60 doesn't support `scrollTo` @@ -6507,7 +6511,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): tab.js + * Bootstrap (v5.2.0): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6608,15 +6612,9 @@ this._activate(getElementFromSelector(element)); // Search and activate/show the proper section - const isAnimated = element.classList.contains(CLASS_NAME_FADE$1); - const complete = () => { - if (isAnimated) { - // todo: maybe is redundant - element.classList.add(CLASS_NAME_SHOW$1); - } - if (element.getAttribute('role') !== 'tab') { + element.classList.add(CLASS_NAME_SHOW$1); return; } @@ -6631,7 +6629,7 @@ }); }; - this._queueCallback(complete, element, isAnimated); + this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); } _deactivate(element, relatedElem) { @@ -6645,15 +6643,9 @@ this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too - const isAnimated = element.classList.contains(CLASS_NAME_FADE$1); - const complete = () => { - if (isAnimated) { - // todo maybe is redundant - element.classList.remove(CLASS_NAME_SHOW$1); - } - if (element.getAttribute('role') !== 'tab') { + element.classList.remove(CLASS_NAME_SHOW$1); return; } @@ -6667,7 +6659,7 @@ }); }; - this._queueCallback(complete, element, isAnimated); + this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); } _keydown(event) { @@ -6832,7 +6824,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): toast.js + * Bootstrap (v5.2.0): toast.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -7049,7 +7041,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): index.umd.js + * Bootstrap (v5.2.0): index.umd.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ |