Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glex.spb@gmail.com>2021-01-05 18:50:14 +0300
committerGleb Mazovetskiy <glex.spb@gmail.com>2021-01-05 18:50:14 +0300
commitcd3fbc224696165e8512fff126cc514307a3cdb5 (patch)
treef0cab95bd7ab4b14c4565a458b06340ab842b034 /assets/javascripts/bootstrap/tooltip.js
parent687c95032ccaf5e8dad4a5c3958e41305cc278b4 (diff)
Update to 5.0.0.beta1v5.0.0.beta1
1. rake update[v5.0.0-beta1] 2. Update version.rb and the README version
Diffstat (limited to 'assets/javascripts/bootstrap/tooltip.js')
-rw-r--r--assets/javascripts/bootstrap/tooltip.js375
1 files changed, 227 insertions, 148 deletions
diff --git a/assets/javascripts/bootstrap/tooltip.js b/assets/javascripts/bootstrap/tooltip.js
index d9f02db..930edb4 100644
--- a/assets/javascripts/bootstrap/tooltip.js
+++ b/assets/javascripts/bootstrap/tooltip.js
@@ -1,25 +1,45 @@
/*!
- * Bootstrap tooltip.js v5.0.0-alpha3 (https://getbootstrap.com/)
+ * Bootstrap tooltip.js v5.0.0-beta1 (https://getbootstrap.com/)
* Copyright 2011-2020 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/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
-}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
+}(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+ function _interopNamespace(e) {
+ if (e && e.__esModule) return e;
+ var n = Object.create(null);
+ if (e) {
+ Object.keys(e).forEach(function (k) {
+ if (k !== 'default') {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () {
+ return e[k];
+ }
+ });
+ }
+ });
+ }
+ n['default'] = e;
+ return Object.freeze(n);
+ }
+
+ var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
- var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): util/index.js
+ * Bootstrap (v5.0.0-beta1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -59,8 +79,8 @@
transitionDuration = _window$getComputedSt.transitionDuration,
transitionDelay = _window$getComputedSt.transitionDelay;
- var floatTransitionDuration = parseFloat(transitionDuration);
- var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
+ var floatTransitionDuration = Number.parseFloat(transitionDuration);
+ var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
@@ -69,7 +89,7 @@
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
- return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
};
var triggerTransitionEnd = function triggerTransitionEnd(element) {
@@ -141,7 +161,7 @@
var _window = window,
jQuery = _window.jQuery;
- if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
return jQuery;
}
@@ -156,13 +176,15 @@
}
};
+ var isRTL = document.documentElement.dir === 'rtl';
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): util/sanitizer.js
+ * Bootstrap (v5.0.0-beta1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
- var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
+ var uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
/**
* A pattern that recognizes a commonly useful subset of URLs that are safe.
@@ -182,8 +204,8 @@
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase();
- if (allowedAttributeList.indexOf(attrName) !== -1) {
- if (uriAttrs.indexOf(attrName) !== -1) {
+ if (allowedAttributeList.includes(attrName)) {
+ if (uriAttrs.has(attrName)) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
}
@@ -259,7 +281,7 @@
var el = elements[i];
var elName = el.nodeName.toLowerCase();
- if (allowlistKeys.indexOf(elName) === -1) {
+ if (!allowlistKeys.includes(elName)) {
el.parentNode.removeChild(el);
return "continue";
}
@@ -283,8 +305,6 @@
return createdDocument.body.innerHTML;
}
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@@ -294,13 +314,60 @@
* ------------------------------------------------------------------------
*/
+ var VERSION = '5.0.0-beta1';
+
+ var BaseComponent = /*#__PURE__*/function () {
+ function BaseComponent(element) {
+ if (!element) {
+ return;
+ }
+
+ this._element = element;
+ Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
+ }
+
+ var _proto = BaseComponent.prototype;
+
+ _proto.dispose = function dispose() {
+ Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
+ this._element = null;
+ }
+ /** Static */
+ ;
+
+ BaseComponent.getInstance = function getInstance(element) {
+ return Data__default['default'].getData(element, this.DATA_KEY);
+ };
+
+ _createClass(BaseComponent, null, [{
+ key: "VERSION",
+ get: function get() {
+ return VERSION;
+ }
+ }]);
+
+ return BaseComponent;
+ }();
+
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
+
+ function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
+ /**
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
+ */
+
var NAME = 'tooltip';
- var VERSION = '5.0.0-alpha3';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
+ var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
var DefaultType = {
animation: 'boolean',
template: 'string',
@@ -310,10 +377,10 @@
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
- offset: '(number|string|function)',
container: '(string|element|boolean)',
- fallbackPlacement: '(string|array)',
+ fallbackPlacements: '(null|array)',
boundary: '(string|element)',
+ customClass: '(string|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
allowList: 'object',
@@ -322,23 +389,23 @@
var AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
- RIGHT: 'right',
+ RIGHT: isRTL ? 'left' : 'right',
BOTTOM: 'bottom',
- LEFT: 'left'
+ LEFT: isRTL ? 'right' : 'left'
};
var Default = {
animation: true,
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
- offset: 0,
container: false,
- fallbackPlacement: 'flip',
- boundary: 'scrollParent',
+ fallbackPlacements: null,
+ boundary: 'clippingParents',
+ customClass: '',
sanitize: true,
sanitizeFn: null,
allowList: DefaultAllowlist,
@@ -372,26 +439,30 @@
* ------------------------------------------------------------------------
*/
- var Tooltip = /*#__PURE__*/function () {
+ var Tooltip = /*#__PURE__*/function (_BaseComponent) {
+ _inheritsLoose(Tooltip, _BaseComponent);
+
function Tooltip(element, config) {
- if (typeof Popper__default['default'] === 'undefined') {
- throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
- } // private
+ var _this;
+ if (typeof Popper__namespace === 'undefined') {
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
+ }
- this._isEnabled = true;
- this._timeout = 0;
- this._hoverState = '';
- this._activeTrigger = {};
- this._popper = null; // Protected
+ _this = _BaseComponent.call(this, element) || this; // private
- this.element = element;
- this.config = this._getConfig(config);
- this.tip = null;
+ _this._isEnabled = true;
+ _this._timeout = 0;
+ _this._hoverState = '';
+ _this._activeTrigger = {};
+ _this._popper = null; // Protected
- this._setListeners();
+ _this.config = _this._getConfig(config);
+ _this.tip = null;
- Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
+ _this._setListeners();
+
+ return _this;
} // Getters
@@ -444,9 +515,8 @@
_proto.dispose = function dispose() {
clearTimeout(this._timeout);
- Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
- EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
- EventHandler__default['default'].off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
+ EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
+ EventHandler__default['default'].off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) {
this.tip.parentNode.removeChild(this.tip);
@@ -462,22 +532,23 @@
}
this._popper = null;
- this.element = null;
this.config = null;
this.tip = null;
+
+ _BaseComponent.prototype.dispose.call(this);
};
_proto.show = function show() {
- var _this = this;
+ var _this2 = this;
- if (this.element.style.display === 'none') {
+ if (this._element.style.display === 'none') {
throw new Error('Please use show on visible elements');
}
if (this.isWithContent() && this._isEnabled) {
- var showEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.SHOW);
- var shadowRoot = findShadowRoot(this.element);
- var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
+ var showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
+ var shadowRoot = findShadowRoot(this._element);
+ var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) {
return;
@@ -486,14 +557,16 @@
var tip = this.getTipElement();
var tipId = getUID(this.constructor.NAME);
tip.setAttribute('id', tipId);
- this.element.setAttribute('aria-describedby', tipId);
+
+ this._element.setAttribute('aria-describedby', tipId);
+
this.setContent();
if (this.config.animation) {
tip.classList.add(CLASS_NAME_FADE);
}
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
var attachment = this._getAttachment(placement);
@@ -503,17 +576,25 @@
Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
- if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
container.appendChild(tip);
}
- EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
- this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
- tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
+ this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
+ tip.classList.add(CLASS_NAME_SHOW);
+ var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
+
+ if (customClass) {
+ var _tip$classList;
+
+ (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
+ } // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
+
if ('ontouchstart' in document.documentElement) {
var _ref;
@@ -523,16 +604,12 @@
}
var complete = function complete() {
- if (_this.config.animation) {
- _this._fixTransition();
- }
-
- var prevHoverState = _this._hoverState;
- _this._hoverState = null;
- EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
+ var prevHoverState = _this2._hoverState;
+ _this2._hoverState = null;
+ EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
if (prevHoverState === HOVER_STATE_OUT) {
- _this._leave(null, _this);
+ _this2._leave(null, _this2);
}
};
@@ -547,7 +624,7 @@
};
_proto.hide = function hide() {
- var _this2 = this;
+ var _this3 = this;
if (!this._popper) {
return;
@@ -556,20 +633,24 @@
var tip = this.getTipElement();
var complete = function complete() {
- if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
+ if (_this3._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
- _this2._cleanTipClass();
+ _this3._cleanTipClass();
+
+ _this3._element.removeAttribute('aria-describedby');
- _this2.element.removeAttribute('aria-describedby');
+ EventHandler__default['default'].trigger(_this3._element, _this3.constructor.Event.HIDDEN);
- EventHandler__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
+ if (_this3._popper) {
+ _this3._popper.destroy();
- _this2._popper.destroy();
+ _this3._popper = null;
+ }
};
- var hideEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.HIDE);
+ var hideEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDE);
if (hideEvent.defaultPrevented) {
return;
@@ -603,7 +684,7 @@
_proto.update = function update() {
if (this._popper !== null) {
- this._popper.scheduleUpdate();
+ this._popper.update();
}
} // Protected
;
@@ -664,64 +745,73 @@
};
_proto.getTitle = function getTitle() {
- var title = this.element.getAttribute('data-original-title');
+ var title = this._element.getAttribute('data-bs-original-title');
if (!title) {
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
+ title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title;
}
return title;
+ };
+
+ _proto.updateAttachment = function updateAttachment(attachment) {
+ if (attachment === 'right') {
+ return 'end';
+ }
+
+ if (attachment === 'left') {
+ return 'start';
+ }
+
+ return attachment;
} // Private
;
_proto._getPopperConfig = function _getPopperConfig(attachment) {
- var _this3 = this;
+ var _this4 = this;
+
+ var flipModifier = {
+ name: 'flip',
+ options: {
+ altBoundary: true
+ }
+ };
+
+ if (this.config.fallbackPlacements) {
+ flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
+ }
var defaultBsConfig = {
placement: attachment,
- modifiers: {
- offset: this._getOffset(),
- flip: {
- behavior: this.config.fallbackPlacement
- },
- arrow: {
+ modifiers: [flipModifier, {
+ name: 'preventOverflow',
+ options: {
+ rootBoundary: this.config.boundary
+ }
+ }, {
+ name: 'arrow',
+ options: {
element: "." + this.constructor.NAME + "-arrow"
- },
- preventOverflow: {
- boundariesElement: this.config.boundary
}
- },
- onCreate: function onCreate(data) {
- if (data.originalPlacement !== data.placement) {
- _this3._handlePopperPlacementChange(data);
+ }, {
+ name: 'onChange',
+ enabled: true,
+ phase: 'afterWrite',
+ fn: function fn(data) {
+ return _this4._handlePopperPlacementChange(data);
+ }
+ }],
+ onFirstUpdate: function onFirstUpdate(data) {
+ if (data.options.placement !== data.placement) {
+ _this4._handlePopperPlacementChange(data);
}
- },
- onUpdate: function onUpdate(data) {
- return _this3._handlePopperPlacementChange(data);
}
};
return _extends({}, defaultBsConfig, this.config.popperConfig);
};
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
- };
-
- _proto._getOffset = function _getOffset() {
- var _this4 = this;
-
- var offset = {};
-
- if (typeof this.config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
- return data;
- };
- } else {
- offset.offset = this.config.offset;
- }
-
- return offset;
+ this.getTipElement().classList.add(CLASS_PREFIX + "-" + this.updateAttachment(attachment));
};
_proto._getContainer = function _getContainer() {
@@ -746,28 +836,28 @@
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
- EventHandler__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
+ EventHandler__default['default'].on(_this5._element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
return _this5.toggle(event);
});
} else if (trigger !== TRIGGER_MANUAL) {
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
- EventHandler__default['default'].on(_this5.element, eventIn, _this5.config.selector, function (event) {
+ EventHandler__default['default'].on(_this5._element, eventIn, _this5.config.selector, function (event) {
return _this5._enter(event);
});
- EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) {
+ EventHandler__default['default'].on(_this5._element, eventOut, _this5.config.selector, function (event) {
return _this5._leave(event);
});
}
});
this._hideModalHandler = function () {
- if (_this5.element) {
+ if (_this5._element) {
_this5.hide();
}
};
- EventHandler__default['default'].on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
+ EventHandler__default['default'].on(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.config.selector) {
this.config = _extends({}, this.config, {
@@ -780,11 +870,18 @@
};
_proto._fixTitle = function _fixTitle() {
- var titleType = typeof this.element.getAttribute('data-original-title');
+ var title = this._element.getAttribute('title');
+
+ var originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
+
+ if (title || originalTitleType !== 'string') {
+ this._element.setAttribute('data-bs-original-title', title || '');
- if (this.element.getAttribute('title') || titleType !== 'string') {
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
- this.element.setAttribute('title', '');
+ if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
+ this._element.setAttribute('aria-label', title);
+ }
+
+ this._element.setAttribute('title', '');
}
};
@@ -864,9 +961,9 @@
};
_proto._getConfig = function _getConfig(config) {
- var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
+ var dataAttributes = Manipulator__default['default'].getDataAttributes(this._element);
Object.keys(dataAttributes).forEach(function (dataAttr) {
- if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
+ if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
delete dataAttributes[dataAttr];
}
});
@@ -929,26 +1026,17 @@
};
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
- this.tip = popperData.instance.popper;
-
- this._cleanTipClass();
-
- this._addAttachmentClass(this._getAttachment(popperData.placement));
- };
+ var state = popperData.state;
- _proto._fixTransition = function _fixTransition() {
- var tip = this.getTipElement();
- var initConfigAnimation = this.config.animation;
-
- if (tip.getAttribute('x-placement') !== null) {
+ if (!state) {
return;
}
- tip.classList.remove(CLASS_NAME_FADE);
- this.config.animation = false;
- this.hide();
- this.show();
- this.config.animation = initConfigAnimation;
+ this.tip = state.elements.popper;
+
+ this._cleanTipClass();
+
+ this._addAttachmentClass(this._getAttachment(state.placement));
} // Static
;
@@ -976,16 +1064,7 @@
});
};
- Tooltip.getInstance = function getInstance(element) {
- return Data__default['default'].getData(element, DATA_KEY);
- };
-
- _createClass(Tooltip, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION;
- }
- }, {
+ _createClass$1(Tooltip, null, [{
key: "Default",
get: function get() {
return Default;
@@ -1018,7 +1097,7 @@
}]);
return Tooltip;
- }();
+ }(BaseComponent);
/**
* ------------------------------------------------------------------------
* jQuery