assets/javascripts/bootstrap.js in bootstrap-5.1.1 vs assets/javascripts/bootstrap.js in bootstrap-5.1.2

- old
+ new

@@ -1,41 +1,39 @@ /*! - * Bootstrap v5.1.1 (https://getbootstrap.com/) + * Bootstrap v5.1.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('@popperjs/core')) : typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper)); -}(this, (function (Popper) { 'use strict'; +})(this, (function (Popper) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; - var n = Object.create(null); + const n = Object.create(null); if (e) { - Object.keys(e).forEach(function (k) { + for (const k in e) { if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); + const d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, - get: function () { - return e[k]; - } + get: () => e[k] }); } - }); + } } - n['default'] = e; + n.default = e; return Object.freeze(n); } - var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper); + const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/index.js + * Bootstrap (v5.1.2): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const MAX_UID = 1000000; const MILLISECONDS_MULTIPLIER = 1000; @@ -342,11 +340,11 @@ return list[Math.max(0, Math.min(index, listLength - 1))]; }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): dom/event-handler.js + * Bootstrap (v5.1.2): dom/event-handler.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -630,22 +628,22 @@ }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): dom/data.js + * Bootstrap (v5.1.2): dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ const elementMap = new Map(); - var Data = { + const Data = { set(element, key, instance) { if (!elementMap.has(element)) { elementMap.set(element, new Map()); } @@ -684,21 +682,21 @@ }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): base-component.js + * Bootstrap (v5.1.2): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ - const VERSION = '5.1.1'; + const VERSION = '5.1.2'; class BaseComponent { constructor(element) { element = getElement(element); @@ -750,11 +748,11 @@ } /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/component-functions.js + * Bootstrap (v5.1.2): util/component-functions.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const enableDismissTrigger = (component, method = 'hide') => { @@ -776,11 +774,11 @@ }); }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): alert.js + * Bootstrap (v5.1.2): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -865,11 +863,11 @@ defineJQueryPlugin(Alert); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): button.js + * Bootstrap (v5.1.2): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -936,11 +934,11 @@ defineJQueryPlugin(Button); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): dom/manipulator.js + * Bootstrap (v5.1.2): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ function normalizeData(val) { if (val === 'true') { @@ -1010,11 +1008,11 @@ }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): dom/selector-engine.js + * Bootstrap (v5.1.2): dom/selector-engine.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const NODE_TEXT = 3; const SelectorEngine = { @@ -1080,11 +1078,11 @@ }; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): carousel.js + * Bootstrap (v5.1.2): carousel.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -1348,11 +1346,11 @@ this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); } }; SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { - EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); + EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault()); }); if (this._pointerEvent) { EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); @@ -1629,11 +1627,11 @@ defineJQueryPlugin(Carousel); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): collapse.js + * Bootstrap (v5.1.2): collapse.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -1660,10 +1658,11 @@ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; const CLASS_NAME_SHOW$7 = 'show'; const CLASS_NAME_COLLAPSE = 'collapse'; const CLASS_NAME_COLLAPSING = 'collapsing'; const CLASS_NAME_COLLAPSED = 'collapsed'; + const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; const WIDTH = 'width'; const HEIGHT = 'height'; const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; @@ -1729,11 +1728,11 @@ let actives = []; let activesData; if (this._config.parent) { - const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth } const container = SelectorEngine.findOne(this._selector); @@ -1867,11 +1866,11 @@ _initializeChildren() { if (!this._config.parent) { return; } - const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { const selected = getElementFromSelector(element); if (selected) { this._addAriaAndCollapsedClass([element], this._isShown(selected)); @@ -1947,11 +1946,11 @@ defineJQueryPlugin(Collapse); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): dropdown.js + * Bootstrap (v5.1.2): dropdown.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -2409,11 +2408,11 @@ defineJQueryPlugin(Dropdown); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/scrollBar.js + * Bootstrap (v5.1.2): util/scrollBar.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; const SELECTOR_STICKY_CONTENT = '.sticky-top'; @@ -2513,12 +2512,12 @@ } /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/backdrop.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Bootstrap (v5.1.2): util/backdrop.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const Default$7 = { className: 'modal-backdrop', isVisible: true, @@ -2637,12 +2636,12 @@ } /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/focustrap.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Bootstrap (v5.1.2): util/focustrap.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const Default$6 = { trapElement: null, // The element to trap focus inside of @@ -2740,11 +2739,11 @@ } /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): modal.js + * Bootstrap (v5.1.2): modal.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -3169,12 +3168,12 @@ defineJQueryPlugin(Modal); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): offcanvas.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Bootstrap (v5.1.2): offcanvas.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants @@ -3425,46 +3424,46 @@ defineJQueryPlugin(Offcanvas); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/sanitizer.js + * Bootstrap (v5.1.2): util/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ - const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); + const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; /** * A pattern that recognizes a commonly useful subset of URLs that are safe. * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts + * Shoutout 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):|[^#&/:?]*(?:[#/?]|$))/i; + 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 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts + * Shoutout 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; - const allowedAttribute = (attr, allowedAttributeList) => { - const attrName = attr.nodeName.toLowerCase(); + const allowedAttribute = (attribute, allowedAttributeList) => { + const attributeName = attribute.nodeName.toLowerCase(); - if (allowedAttributeList.includes(attrName)) { - if (uriAttrs.has(attrName)) { - return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); + if (allowedAttributeList.includes(attributeName)) { + if (uriAttributes.has(attributeName)) { + return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); } return true; } - const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute. + const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute. for (let i = 0, len = regExp.length; i < len; i++) { - if (regExp[i].test(attrName)) { + if (regExp[i].test(attributeName)) { return true; } } return false; @@ -3512,37 +3511,36 @@ return sanitizeFn(unsafeHtml); } const domParser = new window.DOMParser(); const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); - const allowlistKeys = Object.keys(allowList); const elements = [].concat(...createdDocument.body.querySelectorAll('*')); for (let i = 0, len = elements.length; i < len; i++) { - const el = elements[i]; - const elName = el.nodeName.toLowerCase(); + const element = elements[i]; + const elementName = element.nodeName.toLowerCase(); - if (!allowlistKeys.includes(elName)) { - el.remove(); + if (!Object.keys(allowList).includes(elementName)) { + element.remove(); continue; } - const attributeList = [].concat(...el.attributes); - const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); - attributeList.forEach(attr => { - if (!allowedAttribute(attr, allowedAttributes)) { - el.removeAttribute(attr.nodeName); + const attributeList = [].concat(...element.attributes); + const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); + attributeList.forEach(attribute => { + if (!allowedAttribute(attribute, allowedAttributes)) { + element.removeAttribute(attribute.nodeName); } }); } return createdDocument.body.innerHTML; } /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): tooltip.js + * Bootstrap (v5.1.2): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -4248,11 +4246,11 @@ defineJQueryPlugin(Tooltip); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): popover.js + * Bootstrap (v5.1.2): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -4358,11 +4356,11 @@ defineJQueryPlugin(Popover); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): scrollspy.js + * Bootstrap (v5.1.2): scrollspy.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -4593,11 +4591,11 @@ defineJQueryPlugin(ScrollSpy); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): tab.js + * Bootstrap (v5.1.2): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -4791,11 +4789,11 @@ defineJQueryPlugin(Tab); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): toast.js + * Bootstrap (v5.1.2): toast.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ @@ -5021,15 +5019,15 @@ defineJQueryPlugin(Toast); /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): index.umd.js + * Bootstrap (v5.1.2): index.umd.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ - var index_umd = { + const index_umd = { Alert, Button, Carousel, Collapse, Dropdown, @@ -5042,6 +5040,6 @@ Tooltip }; return index_umd; -}))); +}));