diff options
author | XhmikosR <xhmikosr@gmail.com> | 2022-07-19 18:43:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-19 18:43:58 +0300 |
commit | edf9c40956d19e6ab3f9151bfe0dfac6be06fa21 (patch) | |
tree | aa08e0842ee3260dda2a5eddc52d346bdc4c0508 /js/dist/tooltip.js | |
parent | f451b4161e4e499f5d1b743802302e6b19a5dc4c (diff) |
Release v5.2.0 (#36768)v5.2.0
* Bump version to 5.2.0
* Dist
* Update masthead.html
Diffstat (limited to 'js/dist/tooltip.js')
-rw-r--r-- | js/dist/tooltip.js | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/js/dist/tooltip.js b/js/dist/tooltip.js index 9af74c8dbb..56744f1882 100644 --- a/js/dist/tooltip.js +++ b/js/dist/tooltip.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tooltip.js v5.2.0-beta1 (https://getbootstrap.com/) + * Bootstrap tooltip.js 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) */ @@ -37,7 +37,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) * -------------------------------------------------------------------------- */ @@ -75,42 +75,42 @@ LEFT: index.isRTL() ? 'right' : 'left' }; const Default = { + allowList: sanitizer.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: sanitizer.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 = { + 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 @@ -129,7 +129,8 @@ this._isHovered = false; this._activeTrigger = {}; this._popper = null; - this._templateFactory = null; // Protected + this._templateFactory = null; + this._newContent = null; // Protected this.tip = null; @@ -219,6 +220,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(); @@ -237,7 +244,7 @@ if (this._popper) { this._popper.update(); } else { - this._createPopper(tip); + this._popper = this._createPopper(tip); } tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra @@ -323,7 +330,7 @@ _getTipElement() { if (!this.tip) { - this.tip = this._createTipElement(this._getContentForTemplate()); + this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); } return this.tip; @@ -351,19 +358,11 @@ } setContent(content) { - let isShown = false; - - if (this.tip) { - isShown = this._isShown(); - this.tip.remove(); - this.tip = null; - } - - this._disposePopper(); + this._newContent = content; - this.tip = this._createTipElement(content); + if (this._isShown()) { + this._disposePopper(); - if (isShown) { this.show(); } } @@ -390,7 +389,7 @@ } _getTitle() { - return this._config.title; + return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle; } // Private @@ -409,7 +408,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 = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment)); + return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment)); } _getOffset() { @@ -522,7 +521,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); } @@ -598,7 +597,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(); |