aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/src')
-rw-r--r--vendor/twbs/bootstrap/js/src/alert.js10
-rw-r--r--vendor/twbs/bootstrap/js/src/base-component.js12
-rw-r--r--vendor/twbs/bootstrap/js/src/button.js8
-rw-r--r--vendor/twbs/bootstrap/js/src/carousel.js17
-rw-r--r--vendor/twbs/bootstrap/js/src/collapse.js23
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/data.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/event-handler.js14
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/manipulator.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/selector-engine.js53
-rw-r--r--vendor/twbs/bootstrap/js/src/dropdown.js19
-rw-r--r--vendor/twbs/bootstrap/js/src/modal.js20
-rw-r--r--vendor/twbs/bootstrap/js/src/offcanvas.js21
-rw-r--r--vendor/twbs/bootstrap/js/src/popover.js6
-rw-r--r--vendor/twbs/bootstrap/js/src/scrollspy.js10
-rw-r--r--vendor/twbs/bootstrap/js/src/tab.js16
-rw-r--r--vendor/twbs/bootstrap/js/src/toast.js10
-rw-r--r--vendor/twbs/bootstrap/js/src/tooltip.js52
-rw-r--r--vendor/twbs/bootstrap/js/src/util/backdrop.js8
-rw-r--r--vendor/twbs/bootstrap/js/src/util/component-functions.js9
-rw-r--r--vendor/twbs/bootstrap/js/src/util/config.js9
-rw-r--r--vendor/twbs/bootstrap/js/src/util/focustrap.js8
-rw-r--r--vendor/twbs/bootstrap/js/src/util/index.js68
-rw-r--r--vendor/twbs/bootstrap/js/src/util/sanitizer.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/util/scrollbar.js8
-rw-r--r--vendor/twbs/bootstrap/js/src/util/swipe.js8
-rw-r--r--vendor/twbs/bootstrap/js/src/util/template-factory.js12
26 files changed, 211 insertions, 216 deletions
diff --git a/vendor/twbs/bootstrap/js/src/alert.js b/vendor/twbs/bootstrap/js/src/alert.js
index 6ab6650c1..a267d8a26 100644
--- a/vendor/twbs/bootstrap/js/src/alert.js
+++ b/vendor/twbs/bootstrap/js/src/alert.js
@@ -1,14 +1,14 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): alert.js
+ * Bootstrap (v5.3.0-alpha1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin } from './util/index'
-import EventHandler from './dom/event-handler'
-import BaseComponent from './base-component'
-import { enableDismissTrigger } from './util/component-functions'
+import { defineJQueryPlugin } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import BaseComponent from './base-component.js'
+import { enableDismissTrigger } from './util/component-functions.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/base-component.js b/vendor/twbs/bootstrap/js/src/base-component.js
index dba5e0742..6b64aefd6 100644
--- a/vendor/twbs/bootstrap/js/src/base-component.js
+++ b/vendor/twbs/bootstrap/js/src/base-component.js
@@ -1,20 +1,20 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): base-component.js
+ * Bootstrap (v5.3.0-alpha1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import Data from './dom/data'
-import { executeAfterTransition, getElement } from './util/index'
-import EventHandler from './dom/event-handler'
-import Config from './util/config'
+import Data from './dom/data.js'
+import { executeAfterTransition, getElement } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import Config from './util/config.js'
/**
* Constants
*/
-const VERSION = '5.2.2'
+const VERSION = '5.3.0-alpha1'
/**
* Class definition
diff --git a/vendor/twbs/bootstrap/js/src/button.js b/vendor/twbs/bootstrap/js/src/button.js
index e70525c8b..b0f043f45 100644
--- a/vendor/twbs/bootstrap/js/src/button.js
+++ b/vendor/twbs/bootstrap/js/src/button.js
@@ -1,13 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): button.js
+ * Bootstrap (v5.3.0-alpha1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin } from './util/index'
-import EventHandler from './dom/event-handler'
-import BaseComponent from './base-component'
+import { defineJQueryPlugin } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import BaseComponent from './base-component.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/carousel.js b/vendor/twbs/bootstrap/js/src/carousel.js
index 7e89e1614..72c77dc4a 100644
--- a/vendor/twbs/bootstrap/js/src/carousel.js
+++ b/vendor/twbs/bootstrap/js/src/carousel.js
@@ -1,24 +1,23 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): carousel.js
+ * Bootstrap (v5.3.0-alpha1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
- getElementFromSelector,
getNextActiveElement,
isRTL,
isVisible,
reflow,
triggerTransitionEnd
-} from './util/index'
-import EventHandler from './dom/event-handler'
-import Manipulator from './dom/manipulator'
-import SelectorEngine from './dom/selector-engine'
-import Swipe from './util/swipe'
-import BaseComponent from './base-component'
+} from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import Manipulator from './dom/manipulator.js'
+import SelectorEngine from './dom/selector-engine.js'
+import Swipe from './util/swipe.js'
+import BaseComponent from './base-component.js'
/**
* Constants
@@ -431,7 +430,7 @@ class Carousel extends BaseComponent {
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
- const target = getElementFromSelector(this)
+ const target = SelectorEngine.getElementFromSelector(this)
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
return
diff --git a/vendor/twbs/bootstrap/js/src/collapse.js b/vendor/twbs/bootstrap/js/src/collapse.js
index df2bbc647..b1dd7cf8a 100644
--- a/vendor/twbs/bootstrap/js/src/collapse.js
+++ b/vendor/twbs/bootstrap/js/src/collapse.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): collapse.js
+ * Bootstrap (v5.3.0-alpha1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -8,13 +8,11 @@
import {
defineJQueryPlugin,
getElement,
- getElementFromSelector,
- getSelectorFromElement,
reflow
-} from './util/index'
-import EventHandler from './dom/event-handler'
-import SelectorEngine from './dom/selector-engine'
-import BaseComponent from './base-component'
+} from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import SelectorEngine from './dom/selector-engine.js'
+import BaseComponent from './base-component.js'
/**
* Constants
@@ -68,7 +66,7 @@ class Collapse extends BaseComponent {
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
for (const elem of toggleList) {
- const selector = getSelectorFromElement(elem)
+ const selector = SelectorEngine.getSelectorFromElement(elem)
const filterElement = SelectorEngine.find(selector)
.filter(foundElement => foundElement === this._element)
@@ -185,7 +183,7 @@ class Collapse extends BaseComponent {
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)
for (const trigger of this._triggerArray) {
- const element = getElementFromSelector(trigger)
+ const element = SelectorEngine.getElementFromSelector(trigger)
if (element && !this._isShown(element)) {
this._addAriaAndCollapsedClass([trigger], false)
@@ -229,7 +227,7 @@ class Collapse extends BaseComponent {
const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE)
for (const element of children) {
- const selected = getElementFromSelector(element)
+ const selected = SelectorEngine.getElementFromSelector(element)
if (selected) {
this._addAriaAndCollapsedClass([element], this._isShown(selected))
@@ -285,10 +283,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
event.preventDefault()
}
- const selector = getSelectorFromElement(this)
- const selectorElements = SelectorEngine.find(selector)
-
- for (const element of selectorElements) {
+ for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
Collapse.getOrCreateInstance(element, { toggle: false }).toggle()
}
})
diff --git a/vendor/twbs/bootstrap/js/src/dom/data.js b/vendor/twbs/bootstrap/js/src/dom/data.js
index 76c5e0a29..d60d0feda 100644
--- a/vendor/twbs/bootstrap/js/src/dom/data.js
+++ b/vendor/twbs/bootstrap/js/src/dom/data.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/data.js
+ * Bootstrap (v5.3.0-alpha1): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/dom/event-handler.js b/vendor/twbs/bootstrap/js/src/dom/event-handler.js
index c7019a8d0..23c44447a 100644
--- a/vendor/twbs/bootstrap/js/src/dom/event-handler.js
+++ b/vendor/twbs/bootstrap/js/src/dom/event-handler.js
@@ -1,11 +1,11 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/event-handler.js
+ * Bootstrap (v5.3.0-alpha1): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { getjQuery } from '../util/index'
+import { getjQuery } from '../util/index.js'
/**
* Constants
@@ -198,9 +198,8 @@ function removeHandler(element, events, typeEvent, handler, delegationSelector)
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const storeElementEvent = events[typeEvent] || {}
- for (const handlerKey of Object.keys(storeElementEvent)) {
+ for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
- const event = storeElementEvent[handlerKey]
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
}
}
@@ -248,11 +247,10 @@ const EventHandler = {
}
}
- for (const keyHandlers of Object.keys(storeElementEvent)) {
+ for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, '')
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
- const event = storeElementEvent[keyHandlers]
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
}
}
@@ -300,8 +298,8 @@ const EventHandler = {
}
}
-function hydrateObj(obj, meta) {
- for (const [key, value] of Object.entries(meta || {})) {
+function hydrateObj(obj, meta = {}) {
+ for (const [key, value] of Object.entries(meta)) {
try {
obj[key] = value
} catch {
diff --git a/vendor/twbs/bootstrap/js/src/dom/manipulator.js b/vendor/twbs/bootstrap/js/src/dom/manipulator.js
index 04c1dc956..6bc5d197c 100644
--- a/vendor/twbs/bootstrap/js/src/dom/manipulator.js
+++ b/vendor/twbs/bootstrap/js/src/dom/manipulator.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/manipulator.js
+ * Bootstrap (v5.3.0-alpha1): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/dom/selector-engine.js b/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
index 28f23ff8f..49b8f38d6 100644
--- a/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
+++ b/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
@@ -1,15 +1,36 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/selector-engine.js
+ * Bootstrap (v5.3.0-alpha1): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { isDisabled, isVisible } from '../util/index'
+import { isDisabled, isVisible, parseSelector } from '../util/index.js'
-/**
- * Constants
- */
+const getSelector = element => {
+ let selector = element.getAttribute('data-bs-target')
+
+ if (!selector || selector === '#') {
+ let hrefAttribute = element.getAttribute('href')
+
+ // The only valid content that could double as a selector are IDs or classes,
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
+ // `document.querySelector` will rightfully complain it is invalid.
+ // See https://github.com/twbs/bootstrap/issues/32273
+ if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {
+ return null
+ }
+
+ // Just in case some CMS puts out a full URL with the anchor appended
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`
+ }
+
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null
+ }
+
+ return parseSelector(selector)
+}
const SelectorEngine = {
find(selector, element = document.documentElement) {
@@ -77,6 +98,28 @@ const SelectorEngine = {
].map(selector => `${selector}:not([tabindex^="-"])`).join(',')
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))
+ },
+
+ getSelectorFromElement(element) {
+ const selector = getSelector(element)
+
+ if (selector) {
+ return SelectorEngine.findOne(selector) ? selector : null
+ }
+
+ return null
+ },
+
+ getElementFromSelector(element) {
+ const selector = getSelector(element)
+
+ return selector ? SelectorEngine.findOne(selector) : null
+ },
+
+ getMultipleElementsFromSelector(element) {
+ const selector = getSelector(element)
+
+ return selector ? SelectorEngine.find(selector) : []
}
}
diff --git a/vendor/twbs/bootstrap/js/src/dropdown.js b/vendor/twbs/bootstrap/js/src/dropdown.js
index b05d92cf7..6b7c0cef3 100644
--- a/vendor/twbs/bootstrap/js/src/dropdown.js
+++ b/vendor/twbs/bootstrap/js/src/dropdown.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dropdown.js
+ * Bootstrap (v5.3.0-alpha1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -8,6 +8,7 @@
import * as Popper from '@popperjs/core'
import {
defineJQueryPlugin,
+ execute,
getElement,
getNextActiveElement,
isDisabled,
@@ -15,11 +16,11 @@ import {
isRTL,
isVisible,
noop
-} from './util/index'
-import EventHandler from './dom/event-handler'
-import Manipulator from './dom/manipulator'
-import SelectorEngine from './dom/selector-engine'
-import BaseComponent from './base-component'
+} from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import Manipulator from './dom/manipulator.js'
+import SelectorEngine from './dom/selector-engine.js'
+import BaseComponent from './base-component.js'
/**
* Constants
@@ -95,7 +96,7 @@ class Dropdown extends BaseComponent {
this._popper = null
this._parent = this._element.parentNode // dropdown wrapper
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
+ // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
SelectorEngine.findOne(SELECTOR_MENU, this._parent)
@@ -319,7 +320,7 @@ class Dropdown extends BaseComponent {
return {
...defaultBsPopperConfig,
- ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
}
}
@@ -408,7 +409,7 @@ class Dropdown extends BaseComponent {
event.preventDefault()
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
+ // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?
this :
(SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||
diff --git a/vendor/twbs/bootstrap/js/src/modal.js b/vendor/twbs/bootstrap/js/src/modal.js
index c2c5c19e9..0a38586ce 100644
--- a/vendor/twbs/bootstrap/js/src/modal.js
+++ b/vendor/twbs/bootstrap/js/src/modal.js
@@ -1,18 +1,18 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): modal.js
+ * Bootstrap (v5.3.0-alpha1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index'
-import EventHandler from './dom/event-handler'
-import SelectorEngine from './dom/selector-engine'
-import ScrollBarHelper from './util/scrollbar'
-import BaseComponent from './base-component'
-import Backdrop from './util/backdrop'
-import FocusTrap from './util/focustrap'
-import { enableDismissTrigger } from './util/component-functions'
+import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import SelectorEngine from './dom/selector-engine.js'
+import ScrollBarHelper from './util/scrollbar.js'
+import BaseComponent from './base-component.js'
+import Backdrop from './util/backdrop.js'
+import FocusTrap from './util/focustrap.js'
+import { enableDismissTrigger } from './util/component-functions.js'
/**
* Constants
@@ -336,7 +336,7 @@ class Modal extends BaseComponent {
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
- const target = getElementFromSelector(this)
+ const target = SelectorEngine.getElementFromSelector(this)
if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault()
diff --git a/vendor/twbs/bootstrap/js/src/offcanvas.js b/vendor/twbs/bootstrap/js/src/offcanvas.js
index dc3e91075..54adf86cc 100644
--- a/vendor/twbs/bootstrap/js/src/offcanvas.js
+++ b/vendor/twbs/bootstrap/js/src/offcanvas.js
@@ -1,23 +1,22 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): offcanvas.js
+ * Bootstrap (v5.3.0-alpha1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
- getElementFromSelector,
isDisabled,
isVisible
-} from './util/index'
-import ScrollBarHelper from './util/scrollbar'
-import EventHandler from './dom/event-handler'
-import BaseComponent from './base-component'
-import SelectorEngine from './dom/selector-engine'
-import Backdrop from './util/backdrop'
-import FocusTrap from './util/focustrap'
-import { enableDismissTrigger } from './util/component-functions'
+} from './util/index.js'
+import ScrollBarHelper from './util/scrollbar.js'
+import EventHandler from './dom/event-handler.js'
+import BaseComponent from './base-component.js'
+import SelectorEngine from './dom/selector-engine.js'
+import Backdrop from './util/backdrop.js'
+import FocusTrap from './util/focustrap.js'
+import { enableDismissTrigger } from './util/component-functions.js'
/**
* Constants
@@ -231,7 +230,7 @@ class Offcanvas extends BaseComponent {
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
- const target = getElementFromSelector(this)
+ const target = SelectorEngine.getElementFromSelector(this)
if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault()
diff --git a/vendor/twbs/bootstrap/js/src/popover.js b/vendor/twbs/bootstrap/js/src/popover.js
index 93fdc35ff..b7a9f0cb9 100644
--- a/vendor/twbs/bootstrap/js/src/popover.js
+++ b/vendor/twbs/bootstrap/js/src/popover.js
@@ -1,12 +1,12 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): popover.js
+ * Bootstrap (v5.3.0-alpha1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin } from './util/index'
-import Tooltip from './tooltip'
+import { defineJQueryPlugin } from './util/index.js'
+import Tooltip from './tooltip.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/scrollspy.js b/vendor/twbs/bootstrap/js/src/scrollspy.js
index a73bba840..f6af6ee05 100644
--- a/vendor/twbs/bootstrap/js/src/scrollspy.js
+++ b/vendor/twbs/bootstrap/js/src/scrollspy.js
@@ -1,14 +1,14 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): scrollspy.js
+ * Bootstrap (v5.3.0-alpha1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index'
-import EventHandler from './dom/event-handler'
-import SelectorEngine from './dom/selector-engine'
-import BaseComponent from './base-component'
+import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import SelectorEngine from './dom/selector-engine.js'
+import BaseComponent from './base-component.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/tab.js b/vendor/twbs/bootstrap/js/src/tab.js
index a78c27538..cdba0e2e6 100644
--- a/vendor/twbs/bootstrap/js/src/tab.js
+++ b/vendor/twbs/bootstrap/js/src/tab.js
@@ -1,14 +1,14 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): tab.js
+ * Bootstrap (v5.3.0-alpha1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin, getElementFromSelector, getNextActiveElement, isDisabled } from './util/index'
-import EventHandler from './dom/event-handler'
-import SelectorEngine from './dom/selector-engine'
-import BaseComponent from './base-component'
+import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import SelectorEngine from './dom/selector-engine.js'
+import BaseComponent from './base-component.js'
/**
* Constants
@@ -106,7 +106,7 @@ class Tab extends BaseComponent {
element.classList.add(CLASS_NAME_ACTIVE)
- this._activate(getElementFromSelector(element)) // Search and activate/show the proper section
+ this._activate(SelectorEngine.getElementFromSelector(element)) // Search and activate/show the proper section
const complete = () => {
if (element.getAttribute('role') !== 'tab') {
@@ -133,7 +133,7 @@ class Tab extends BaseComponent {
element.classList.remove(CLASS_NAME_ACTIVE)
element.blur()
- this._deactivate(getElementFromSelector(element)) // Search and deactivate the shown section too
+ this._deactivate(SelectorEngine.getElementFromSelector(element)) // Search and deactivate the shown section too
const complete = () => {
if (element.getAttribute('role') !== 'tab') {
@@ -203,7 +203,7 @@ class Tab extends BaseComponent {
}
_setInitialAttributesOnTargetPanel(child) {
- const target = getElementFromSelector(child)
+ const target = SelectorEngine.getElementFromSelector(child)
if (!target) {
return
diff --git a/vendor/twbs/bootstrap/js/src/toast.js b/vendor/twbs/bootstrap/js/src/toast.js
index aef5da3a9..ff801668f 100644
--- a/vendor/twbs/bootstrap/js/src/toast.js
+++ b/vendor/twbs/bootstrap/js/src/toast.js
@@ -1,14 +1,14 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): toast.js
+ * Bootstrap (v5.3.0-alpha1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin, reflow } from './util/index'
-import EventHandler from './dom/event-handler'
-import BaseComponent from './base-component'
-import { enableDismissTrigger } from './util/component-functions'
+import { defineJQueryPlugin, reflow } from './util/index.js'
+import EventHandler from './dom/event-handler.js'
+import BaseComponent from './base-component.js'
+import { enableDismissTrigger } from './util/component-functions.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/tooltip.js b/vendor/twbs/bootstrap/js/src/tooltip.js
index e01f0a4ae..e152ec214 100644
--- a/vendor/twbs/bootstrap/js/src/tooltip.js
+++ b/vendor/twbs/bootstrap/js/src/tooltip.js
@@ -1,17 +1,17 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): tooltip.js
+ * Bootstrap (v5.3.0-alpha1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import * as Popper from '@popperjs/core'
-import { defineJQueryPlugin, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index'
-import { DefaultAllowlist } from './util/sanitizer'
-import EventHandler from './dom/event-handler'
-import Manipulator from './dom/manipulator'
-import BaseComponent from './base-component'
-import TemplateFactory from './util/template-factory'
+import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js'
+import { DefaultAllowlist } from './util/sanitizer.js'
+import EventHandler from './dom/event-handler.js'
+import Manipulator from './dom/manipulator.js'
+import BaseComponent from './base-component.js'
+import TemplateFactory from './util/template-factory.js'
/**
* Constants
@@ -172,10 +172,6 @@ class Tooltip extends BaseComponent {
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
- if (this.tip) {
- this.tip.remove()
- }
-
if (this._element.getAttribute('data-bs-original-title')) {
this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'))
}
@@ -202,10 +198,7 @@ class Tooltip extends BaseComponent {
}
// todo v6 remove this OR make it optional
- if (this.tip) {
- this.tip.remove()
- this.tip = null
- }
+ this._disposePopper()
const tip = this._getTipElement()
@@ -218,11 +211,7 @@ class Tooltip extends BaseComponent {
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED))
}
- if (this._popper) {
- this._popper.update()
- } else {
- this._popper = this._createPopper(tip)
- }
+ this._popper = this._createPopper(tip)
tip.classList.add(CLASS_NAME_SHOW)
@@ -281,13 +270,11 @@ class Tooltip extends BaseComponent {
}
if (!this._isHovered) {
- tip.remove()
+ this._disposePopper()
}
this._element.removeAttribute('aria-describedby')
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN))
-
- this._disposePopper()
}
this._queueCallback(complete, this.tip, this._isAnimated())
@@ -383,9 +370,7 @@ class Tooltip extends BaseComponent {
}
_createPopper(tip) {
- const placement = typeof this._config.placement === 'function' ?
- this._config.placement.call(this, tip, this._element) :
- this._config.placement
+ const placement = execute(this._config.placement, [this, tip, this._element])
const attachment = AttachmentMap[placement.toUpperCase()]
return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))
}
@@ -405,7 +390,7 @@ class Tooltip extends BaseComponent {
}
_resolvePossibleFunction(arg) {
- return typeof arg === 'function' ? arg.call(this._element) : arg
+ return execute(arg, [this._element])
}
_getPopperConfig(attachment) {
@@ -451,7 +436,7 @@ class Tooltip extends BaseComponent {
return {
...defaultBsPopperConfig,
- ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
}
}
@@ -592,9 +577,9 @@ class Tooltip extends BaseComponent {
_getDelegateConfig() {
const config = {}
- for (const key in this._config) {
- if (this.constructor.Default[key] !== this._config[key]) {
- config[key] = this._config[key]
+ for (const [key, value] of Object.entries(this._config)) {
+ if (this.constructor.Default[key] !== value) {
+ config[key] = value
}
}
@@ -612,6 +597,11 @@ class Tooltip extends BaseComponent {
this._popper.destroy()
this._popper = null
}
+
+ if (this.tip) {
+ this.tip.remove()
+ this.tip = null
+ }
}
// Static
diff --git a/vendor/twbs/bootstrap/js/src/util/backdrop.js b/vendor/twbs/bootstrap/js/src/util/backdrop.js
index 342f8afc1..eab7d40eb 100644
--- a/vendor/twbs/bootstrap/js/src/util/backdrop.js
+++ b/vendor/twbs/bootstrap/js/src/util/backdrop.js
@@ -1,13 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/backdrop.js
+ * Bootstrap (v5.3.0-alpha1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import EventHandler from '../dom/event-handler'
-import { execute, executeAfterTransition, getElement, reflow } from './index'
-import Config from './config'
+import EventHandler from '../dom/event-handler.js'
+import { execute, executeAfterTransition, getElement, reflow } from './index.js'
+import Config from './config.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/util/component-functions.js b/vendor/twbs/bootstrap/js/src/util/component-functions.js
index 798366b07..f059cc825 100644
--- a/vendor/twbs/bootstrap/js/src/util/component-functions.js
+++ b/vendor/twbs/bootstrap/js/src/util/component-functions.js
@@ -1,12 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/component-functions.js
+ * Bootstrap (v5.3.0-alpha1): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import EventHandler from '../dom/event-handler'
-import { getElementFromSelector, isDisabled } from './index'
+import EventHandler from '../dom/event-handler.js'
+import { isDisabled } from './index.js'
+import SelectorEngine from '../dom/selector-engine.js'
const enableDismissTrigger = (component, method = 'hide') => {
const clickEvent = `click.dismiss${component.EVENT_KEY}`
@@ -21,7 +22,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
return
}
- const target = getElementFromSelector(this) || this.closest(`.${name}`)
+ const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`)
const instance = component.getOrCreateInstance(target)
// Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
diff --git a/vendor/twbs/bootstrap/js/src/util/config.js b/vendor/twbs/bootstrap/js/src/util/config.js
index 119a3ea3d..241ea966b 100644
--- a/vendor/twbs/bootstrap/js/src/util/config.js
+++ b/vendor/twbs/bootstrap/js/src/util/config.js
@@ -1,12 +1,12 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/config.js
+ * Bootstrap (v5.3.0-alpha1): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { isElement, toType } from './index'
-import Manipulator from '../dom/manipulator'
+import { isElement, toType } from './index.js'
+import Manipulator from '../dom/manipulator.js'
/**
* Class definition
@@ -49,8 +49,7 @@ class Config {
}
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
- for (const property of Object.keys(configTypes)) {
- const expectedTypes = configTypes[property]
+ for (const [property, expectedTypes] of Object.entries(configTypes)) {
const value = config[property]
const valueType = isElement(value) ? 'element' : toType(value)
diff --git a/vendor/twbs/bootstrap/js/src/util/focustrap.js b/vendor/twbs/bootstrap/js/src/util/focustrap.js
index 01ac76683..2f189585a 100644
--- a/vendor/twbs/bootstrap/js/src/util/focustrap.js
+++ b/vendor/twbs/bootstrap/js/src/util/focustrap.js
@@ -1,13 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/focustrap.js
+ * Bootstrap (v5.3.0-alpha1): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import EventHandler from '../dom/event-handler'
-import SelectorEngine from '../dom/selector-engine'
-import Config from './config'
+import EventHandler from '../dom/event-handler.js'
+import SelectorEngine from '../dom/selector-engine.js'
+import Config from './config.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/util/index.js b/vendor/twbs/bootstrap/js/src/util/index.js
index 7c2411665..cd23835c0 100644
--- a/vendor/twbs/bootstrap/js/src/util/index.js
+++ b/vendor/twbs/bootstrap/js/src/util/index.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/index.js
+ * Bootstrap (v5.3.0-alpha1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -9,6 +9,20 @@ const MAX_UID = 1_000_000
const MILLISECONDS_MULTIPLIER = 1000
const TRANSITION_END = 'transitionend'
+/**
+ * Properly escape IDs selectors to handle weird IDs
+ * @param {string} selector
+ * @returns {string}
+ */
+const parseSelector = selector => {
+ if (selector && window.CSS && window.CSS.escape) {
+ // document.querySelector needs escaping to handle IDs (html5+) containing for instance /
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`)
+ }
+
+ return selector
+}
+
// Shout-out Angus Croll (https://goo.gl/pxwQGp)
const toType = object => {
if (object === null || object === undefined) {
@@ -30,47 +44,6 @@ const getUID = prefix => {
return prefix
}
-const getSelector = element => {
- let selector = element.getAttribute('data-bs-target')
-
- if (!selector || selector === '#') {
- let hrefAttribute = element.getAttribute('href')
-
- // The only valid content that could double as a selector are IDs or classes,
- // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
- // `document.querySelector` will rightfully complain it is invalid.
- // See https://github.com/twbs/bootstrap/issues/32273
- if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {
- return null
- }
-
- // Just in case some CMS puts out a full URL with the anchor appended
- if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
- hrefAttribute = `#${hrefAttribute.split('#')[1]}`
- }
-
- selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null
- }
-
- return selector
-}
-
-const getSelectorFromElement = element => {
- const selector = getSelector(element)
-
- if (selector) {
- return document.querySelector(selector) ? selector : null
- }
-
- return null
-}
-
-const getElementFromSelector = element => {
- const selector = getSelector(element)
-
- return selector ? document.querySelector(selector) : null
-}
-
const getTransitionDurationFromElement = element => {
if (!element) {
return 0
@@ -117,7 +90,7 @@ const getElement = object => {
}
if (typeof object === 'string' && object.length > 0) {
- return document.querySelector(object)
+ return document.querySelector(parseSelector(object))
}
return null
@@ -249,10 +222,8 @@ const defineJQueryPlugin = plugin => {
})
}
-const execute = callback => {
- if (typeof callback === 'function') {
- callback()
- }
+const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
+ return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue
}
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
@@ -318,10 +289,8 @@ export {
executeAfterTransition,
findShadowRoot,
getElement,
- getElementFromSelector,
getjQuery,
getNextActiveElement,
- getSelectorFromElement,
getTransitionDurationFromElement,
getUID,
isDisabled,
@@ -330,6 +299,7 @@ export {
isVisible,
noop,
onDOMContentLoaded,
+ parseSelector,
reflow,
triggerTransitionEnd,
toType
diff --git a/vendor/twbs/bootstrap/js/src/util/sanitizer.js b/vendor/twbs/bootstrap/js/src/util/sanitizer.js
index 6a9daa6ce..30fb3b1a1 100644
--- a/vendor/twbs/bootstrap/js/src/util/sanitizer.js
+++ b/vendor/twbs/bootstrap/js/src/util/sanitizer.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/sanitizer.js
+ * Bootstrap (v5.3.0-alpha1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/util/scrollbar.js b/vendor/twbs/bootstrap/js/src/util/scrollbar.js
index 421426d41..7b01b3596 100644
--- a/vendor/twbs/bootstrap/js/src/util/scrollbar.js
+++ b/vendor/twbs/bootstrap/js/src/util/scrollbar.js
@@ -1,13 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/scrollBar.js
+ * Bootstrap (v5.3.0-alpha1): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import SelectorEngine from '../dom/selector-engine'
-import Manipulator from '../dom/manipulator'
-import { isElement } from './index'
+import SelectorEngine from '../dom/selector-engine.js'
+import Manipulator from '../dom/manipulator.js'
+import { isElement } from './index.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/util/swipe.js b/vendor/twbs/bootstrap/js/src/util/swipe.js
index 7fcd65588..834b02e67 100644
--- a/vendor/twbs/bootstrap/js/src/util/swipe.js
+++ b/vendor/twbs/bootstrap/js/src/util/swipe.js
@@ -1,13 +1,13 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/swipe.js
+ * Bootstrap (v5.3.0-alpha1): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import Config from './config'
-import EventHandler from '../dom/event-handler'
-import { execute } from './index'
+import Config from './config.js'
+import EventHandler from '../dom/event-handler.js'
+import { execute } from './index.js'
/**
* Constants
diff --git a/vendor/twbs/bootstrap/js/src/util/template-factory.js b/vendor/twbs/bootstrap/js/src/util/template-factory.js
index c6d52a50d..82cd8b31c 100644
--- a/vendor/twbs/bootstrap/js/src/util/template-factory.js
+++ b/vendor/twbs/bootstrap/js/src/util/template-factory.js
@@ -1,14 +1,14 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/template-factory.js
+ * Bootstrap (v5.3.0-alpha1): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { DefaultAllowlist, sanitizeHtml } from './sanitizer'
-import { getElement, isElement } from '../util/index'
-import SelectorEngine from '../dom/selector-engine'
-import Config from './config'
+import { DefaultAllowlist, sanitizeHtml } from './sanitizer.js'
+import { execute, getElement, isElement } from './index.js'
+import SelectorEngine from '../dom/selector-engine.js'
+import Config from './config.js'
/**
* Constants
@@ -143,7 +143,7 @@ class TemplateFactory extends Config {
}
_resolvePossibleFunction(arg) {
- return typeof arg === 'function' ? arg(this) : arg
+ return execute(arg, [this])
}
_putElementInTemplate(element, templateElement) {