aboutsummaryrefslogtreecommitdiff
path: root/js/dist/tooltip.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/dist/tooltip.js')
-rw-r--r--js/dist/tooltip.js155
1 files changed, 75 insertions, 80 deletions
diff --git a/js/dist/tooltip.js b/js/dist/tooltip.js
index 879169ebb..270e9bfb2 100644
--- a/js/dist/tooltip.js
+++ b/js/dist/tooltip.js
@@ -1,6 +1,6 @@
/*!
* Bootstrap tooltip.js v4.3.1 (https://getbootstrap.com/)
- * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
(function (global, factory) {
@@ -9,11 +9,11 @@
(global = global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
- Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
- EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
- Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
- Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
- SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
+ Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
+ EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
+ Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
+ Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
+ SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
@@ -65,13 +65,13 @@
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
- ownKeys(source, true).forEach(function (key) {
+ ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
- ownKeys(source).forEach(function (key) {
+ ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
@@ -91,6 +91,10 @@
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
var toType = function toType(obj) {
+ if (obj === null || obj === undefined) {
+ return "" + obj;
+ }
+
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
/**
@@ -132,9 +136,7 @@
};
var triggerTransitionEnd = function triggerTransitionEnd(element) {
- var evt = document.createEvent('HTMLEvents');
- evt.initEvent(TRANSITION_END, true, true);
- element.dispatchEvent(evt);
+ element.dispatchEvent(new Event(TRANSITION_END));
};
var isElement = function isElement(obj) {
@@ -171,14 +173,6 @@
});
};
- var makeArray = function makeArray(nodeList) {
- if (!nodeList) {
- return [];
- }
-
- return [].slice.call(nodeList);
- };
-
var findShadowRoot = function findShadowRoot(element) {
if (!document.documentElement.attachShadow) {
return null;
@@ -231,21 +225,21 @@
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
+ var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
- var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
+ var 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;
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase();
if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.indexOf(attrName) !== -1) {
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
+ return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue);
}
return true;
@@ -255,8 +249,8 @@
return attrRegex instanceof RegExp;
}); // Check if a regular expression validates the attribute.
- for (var i = 0, l = regExp.length; i < l; i++) {
- if (attrName.match(regExp[i])) {
+ for (var i = 0, len = regExp.length; i < len; i++) {
+ if (regExp[i].test(attrName)) {
return true;
}
}
@@ -283,7 +277,7 @@
h5: [],
h6: [],
i: [],
- img: ['src', 'alt', 'title', 'width', 'height'],
+ img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
li: [],
ol: [],
p: [],
@@ -298,6 +292,8 @@
ul: []
};
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
+ var _ref;
+
if (!unsafeHtml.length) {
return unsafeHtml;
}
@@ -309,9 +305,12 @@
var domParser = new window.DOMParser();
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
var whitelistKeys = Object.keys(whiteList);
- var elements = makeArray(createdDocument.body.querySelectorAll('*'));
+
+ var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
var _loop = function _loop(i, len) {
+ var _ref2;
+
var el = elements[i];
var elName = el.nodeName.toLowerCase();
@@ -320,7 +319,8 @@
return "continue";
}
- var attributeList = makeArray(el.attributes);
+ var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);
+
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
attributeList.forEach(function (attr) {
if (!allowedAttribute(attr, whitelistedAttributes)) {
@@ -394,11 +394,7 @@
whiteList: DefaultWhitelist,
popperConfig: null
};
- var HoverState = {
- SHOW: 'show',
- OUT: 'out'
- };
- var Event = {
+ var Event$1 = {
HIDE: "hide" + EVENT_KEY,
HIDDEN: "hidden" + EVENT_KEY,
SHOW: "show" + EVENT_KEY,
@@ -410,28 +406,23 @@
MOUSEENTER: "mouseenter" + EVENT_KEY,
MOUSELEAVE: "mouseleave" + EVENT_KEY
};
- var ClassName = {
- FADE: 'fade',
- SHOW: 'show'
- };
- var Selector = {
- TOOLTIP_INNER: '.tooltip-inner'
- };
- var Trigger = {
- HOVER: 'hover',
- FOCUS: 'focus',
- CLICK: 'click',
- MANUAL: 'manual'
- };
+ var CLASS_NAME_FADE = 'fade';
+ var CLASS_NAME_MODAL = 'modal';
+ var CLASS_NAME_SHOW = 'show';
+ var HOVER_STATE_SHOW = 'show';
+ var HOVER_STATE_OUT = 'out';
+ var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
+ var TRIGGER_HOVER = 'hover';
+ var TRIGGER_FOCUS = 'focus';
+ var TRIGGER_CLICK = 'click';
+ var TRIGGER_MANUAL = 'manual';
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
- var Tooltip =
- /*#__PURE__*/
- function () {
+ var Tooltip = /*#__PURE__*/function () {
function Tooltip(element, config) {
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
@@ -491,7 +482,7 @@
context._leave(null, context);
}
} else {
- if (this.getTipElement().classList.contains(ClassName.SHOW)) {
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
this._leave(null, this);
return;
@@ -505,7 +496,7 @@
clearTimeout(this._timeout);
Data.removeData(this.element, this.constructor.DATA_KEY);
EventHandler.off(this.element, this.constructor.EVENT_KEY);
- EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
+ EventHandler.off(SelectorEngine.closest(this.element, "." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) {
this.tip.parentNode.removeChild(this.tip);
@@ -549,7 +540,7 @@
this.setContent();
if (this.config.animation) {
- tip.classList.add(ClassName.FADE);
+ tip.classList.add(CLASS_NAME_FADE);
}
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
@@ -568,13 +559,15 @@
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
- tip.classList.add(ClassName.SHOW); // If this is a touch-enabled device we add extra
+ tip.classList.add(CLASS_NAME_SHOW); // 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) {
- makeArray(document.body.children).forEach(function (element) {
+ var _ref;
+
+ (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
EventHandler.on(element, 'mouseover', noop());
});
}
@@ -588,12 +581,12 @@
_this._hoverState = null;
EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
- if (prevHoverState === HoverState.OUT) {
+ if (prevHoverState === HOVER_STATE_OUT) {
_this._leave(null, _this);
}
};
- if (this.tip.classList.contains(ClassName.FADE)) {
+ if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, TRANSITION_END, complete);
emulateTransitionEnd(this.tip, transitionDuration);
@@ -609,7 +602,7 @@
var tip = this.getTipElement();
var complete = function complete() {
- if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
+ if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
@@ -628,20 +621,22 @@
return;
}
- tip.classList.remove(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
+ tip.classList.remove(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
- makeArray(document.body.children).forEach(function (element) {
+ var _ref2;
+
+ (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
return EventHandler.off(element, 'mouseover', noop);
});
}
- this._activeTrigger[Trigger.CLICK] = false;
- this._activeTrigger[Trigger.FOCUS] = false;
- this._activeTrigger[Trigger.HOVER] = false;
+ this._activeTrigger[TRIGGER_CLICK] = false;
+ this._activeTrigger[TRIGGER_FOCUS] = false;
+ this._activeTrigger[TRIGGER_HOVER] = false;
- if (this.tip.classList.contains(ClassName.FADE)) {
+ if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, TRANSITION_END, complete);
emulateTransitionEnd(tip, transitionDuration);
@@ -676,9 +671,9 @@
_proto.setContent = function setContent() {
var tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(Selector.TOOLTIP_INNER, tip), this.getTitle());
- tip.classList.remove(ClassName.FADE);
- tip.classList.remove(ClassName.SHOW);
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
+ tip.classList.remove(CLASS_NAME_FADE);
+ tip.classList.remove(CLASS_NAME_SHOW);
};
_proto.setElementContent = function setElementContent(element, content) {
@@ -801,9 +796,9 @@
EventHandler.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;
+ } 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.on(_this5.element, eventIn, _this5.config.selector, function (event) {
return _this5._enter(event);
});
@@ -819,7 +814,7 @@
}
};
- EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
+ EventHandler.on(SelectorEngine.closest(this.element, "." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.config.selector) {
this.config = _objectSpread2({}, this.config, {
@@ -850,16 +845,16 @@
}
if (event) {
- context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
}
- if (context.getTipElement().classList.contains(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
- context._hoverState = HoverState.SHOW;
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
+ context._hoverState = HOVER_STATE_SHOW;
return;
}
clearTimeout(context._timeout);
- context._hoverState = HoverState.SHOW;
+ context._hoverState = HOVER_STATE_SHOW;
if (!context.config.delay || !context.config.delay.show) {
context.show();
@@ -867,7 +862,7 @@
}
context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.SHOW) {
+ if (context._hoverState === HOVER_STATE_SHOW) {
context.show();
}
}, context.config.delay.show);
@@ -883,7 +878,7 @@
}
if (event) {
- context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
}
if (context._isWithActiveTrigger()) {
@@ -891,7 +886,7 @@
}
clearTimeout(context._timeout);
- context._hoverState = HoverState.OUT;
+ context._hoverState = HOVER_STATE_OUT;
if (!context.config.delay || !context.config.delay.hide) {
context.hide();
@@ -899,7 +894,7 @@
}
context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.OUT) {
+ if (context._hoverState === HOVER_STATE_OUT) {
context.hide();
}
}, context.config.delay.hide);
@@ -971,7 +966,7 @@
var tip = this.getTipElement();
var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length) {
+ if (tabClass !== null && tabClass.length > 0) {
tabClass.map(function (token) {
return token.trim();
}).forEach(function (tClass) {
@@ -997,7 +992,7 @@
return;
}
- tip.classList.remove(ClassName.FADE);
+ tip.classList.remove(CLASS_NAME_FADE);
this.config.animation = false;
this.hide();
this.show();
@@ -1056,7 +1051,7 @@
}, {
key: "Event",
get: function get() {
- return Event;
+ return Event$1;
}
}, {
key: "EVENT_KEY",