aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-09-23 08:33:36 +0000
committerMario <mario@mariovavti.com>2021-09-23 08:33:36 +0000
commita451449766d581978068a5b8f8c1e27f50386ea7 (patch)
tree17388d0d116d3c3a3e14745397b5b3278e933d74 /vendor/twbs/bootstrap/js/src
parent3347fab105a01f38800a907e7d6281d835a29f5c (diff)
downloadvolse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.gz
volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.bz2
volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.zip
Revert "composer update bootstrap to version 5.1.1"
This reverts commit 89e4006b2d84d398e34d407a019854823b1dd37d.
Diffstat (limited to 'vendor/twbs/bootstrap/js/src')
-rw-r--r--vendor/twbs/bootstrap/js/src/alert.js68
-rw-r--r--vendor/twbs/bootstrap/js/src/base-component.js6
-rw-r--r--vendor/twbs/bootstrap/js/src/button.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/carousel.js11
-rw-r--r--vendor/twbs/bootstrap/js/src/collapse.js184
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/data.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/event-handler.js3
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/manipulator.js6
-rw-r--r--vendor/twbs/bootstrap/js/src/dom/selector-engine.js19
-rw-r--r--vendor/twbs/bootstrap/js/src/dropdown.js121
-rw-r--r--vendor/twbs/bootstrap/js/src/modal.js59
-rw-r--r--vendor/twbs/bootstrap/js/src/offcanvas.js34
-rw-r--r--vendor/twbs/bootstrap/js/src/popover.js56
-rw-r--r--vendor/twbs/bootstrap/js/src/scrollspy.js31
-rw-r--r--vendor/twbs/bootstrap/js/src/tab.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/toast.js22
-rw-r--r--vendor/twbs/bootstrap/js/src/tooltip.js116
-rw-r--r--vendor/twbs/bootstrap/js/src/util/backdrop.js9
-rw-r--r--vendor/twbs/bootstrap/js/src/util/component-functions.js34
-rw-r--r--vendor/twbs/bootstrap/js/src/util/focustrap.js109
-rw-r--r--vendor/twbs/bootstrap/js/src/util/index.js19
-rw-r--r--vendor/twbs/bootstrap/js/src/util/sanitizer.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/util/scrollbar.js2
23 files changed, 445 insertions, 472 deletions
diff --git a/vendor/twbs/bootstrap/js/src/alert.js b/vendor/twbs/bootstrap/js/src/alert.js
index 97b305138..75dbec71b 100644
--- a/vendor/twbs/bootstrap/js/src/alert.js
+++ b/vendor/twbs/bootstrap/js/src/alert.js
@@ -1,14 +1,16 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): alert.js
+ * Bootstrap (v5.0.2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
-import { defineJQueryPlugin } from './util/index'
+import {
+ defineJQueryPlugin,
+ getElementFromSelector
+} from './util/index'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
-import { enableDismissTrigger } from './util/component-functions'
/**
* ------------------------------------------------------------------------
@@ -19,9 +21,15 @@ import { enableDismissTrigger } from './util/component-functions'
const NAME = 'alert'
const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}`
+const DATA_API_KEY = '.data-api'
+
+const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'
const EVENT_CLOSE = `close${EVENT_KEY}`
const EVENT_CLOSED = `closed${EVENT_KEY}`
+const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
+
+const CLASS_NAME_ALERT = 'alert'
const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
@@ -40,24 +48,38 @@ class Alert extends BaseComponent {
// Public
- close() {
- const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)
+ close(element) {
+ const rootElement = element ? this._getRootElement(element) : this._element
+ const customEvent = this._triggerCloseEvent(rootElement)
- if (closeEvent.defaultPrevented) {
+ if (customEvent === null || customEvent.defaultPrevented) {
return
}
- this._element.classList.remove(CLASS_NAME_SHOW)
-
- const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)
- this._queueCallback(() => this._destroyElement(), this._element, isAnimated)
+ this._removeElement(rootElement)
}
// Private
- _destroyElement() {
- this._element.remove()
- EventHandler.trigger(this._element, EVENT_CLOSED)
- this.dispose()
+
+ _getRootElement(element) {
+ return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`)
+ }
+
+ _triggerCloseEvent(element) {
+ return EventHandler.trigger(element, EVENT_CLOSE)
+ }
+
+ _removeElement(element) {
+ element.classList.remove(CLASS_NAME_SHOW)
+
+ const isAnimated = element.classList.contains(CLASS_NAME_FADE)
+ this._queueCallback(() => this._destroyElement(element), element, isAnimated)
+ }
+
+ _destroyElement(element) {
+ element.remove()
+
+ EventHandler.trigger(element, EVENT_CLOSED)
}
// Static
@@ -66,16 +88,20 @@ class Alert extends BaseComponent {
return this.each(function () {
const data = Alert.getOrCreateInstance(this)
- if (typeof config !== 'string') {
- return
+ if (config === 'close') {
+ data[config](this)
}
+ })
+ }
- if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
- throw new TypeError(`No method named "${config}"`)
+ static handleDismiss(alertInstance) {
+ return function (event) {
+ if (event) {
+ event.preventDefault()
}
- data[config](this)
- })
+ alertInstance.close(this)
+ }
}
}
@@ -85,7 +111,7 @@ class Alert extends BaseComponent {
* ------------------------------------------------------------------------
*/
-enableDismissTrigger(Alert, 'close')
+EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))
/**
* ------------------------------------------------------------------------
diff --git a/vendor/twbs/bootstrap/js/src/base-component.js b/vendor/twbs/bootstrap/js/src/base-component.js
index cb65bed8e..62aa4adf1 100644
--- a/vendor/twbs/bootstrap/js/src/base-component.js
+++ b/vendor/twbs/bootstrap/js/src/base-component.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): base-component.js
+ * Bootstrap (v5.0.2): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@ import EventHandler from './dom/event-handler'
* ------------------------------------------------------------------------
*/
-const VERSION = '5.1.1'
+const VERSION = '5.0.2'
class BaseComponent {
constructor(element) {
@@ -48,7 +48,7 @@ class BaseComponent {
/** Static */
static getInstance(element) {
- return Data.get(getElement(element), this.DATA_KEY)
+ return Data.get(element, this.DATA_KEY)
}
static getOrCreateInstance(element, config = {}) {
diff --git a/vendor/twbs/bootstrap/js/src/button.js b/vendor/twbs/bootstrap/js/src/button.js
index 0578ed6b9..528f6233c 100644
--- a/vendor/twbs/bootstrap/js/src/button.js
+++ b/vendor/twbs/bootstrap/js/src/button.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): button.js
+ * Bootstrap (v5.0.2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/carousel.js b/vendor/twbs/bootstrap/js/src/carousel.js
index 981ce561b..fe43f53eb 100644
--- a/vendor/twbs/bootstrap/js/src/carousel.js
+++ b/vendor/twbs/bootstrap/js/src/carousel.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): carousel.js
+ * Bootstrap (v5.0.2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -260,13 +260,8 @@ class Carousel extends BaseComponent {
}
_addTouchEventListeners() {
- const hasPointerPenTouch = event => {
- return this._pointerEvent &&
- (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
- }
-
const start = event => {
- if (hasPointerPenTouch(event)) {
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchStartX = event.clientX
} else if (!this._pointerEvent) {
this.touchStartX = event.touches[0].clientX
@@ -281,7 +276,7 @@ class Carousel extends BaseComponent {
}
const end = event => {
- if (hasPointerPenTouch(event)) {
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchDeltaX = event.clientX - this.touchStartX
}
diff --git a/vendor/twbs/bootstrap/js/src/collapse.js b/vendor/twbs/bootstrap/js/src/collapse.js
index f38878f9b..8831510df 100644
--- a/vendor/twbs/bootstrap/js/src/collapse.js
+++ b/vendor/twbs/bootstrap/js/src/collapse.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): collapse.js
+ * Bootstrap (v5.0.2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -32,12 +32,12 @@ const DATA_API_KEY = '.data-api'
const Default = {
toggle: true,
- parent: null
+ parent: ''
}
const DefaultType = {
toggle: 'boolean',
- parent: '(null|element)'
+ parent: '(string|element)'
}
const EVENT_SHOW = `show${EVENT_KEY}`
@@ -50,12 +50,11 @@ const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_COLLAPSE = 'collapse'
const CLASS_NAME_COLLAPSING = 'collapsing'
const CLASS_NAME_COLLAPSED = 'collapsed'
-const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'
const WIDTH = 'width'
const HEIGHT = 'height'
-const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'
+const SELECTOR_ACTIVES = '.show, .collapsing'
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]'
/**
@@ -70,7 +69,10 @@ class Collapse extends BaseComponent {
this._isTransitioning = false
this._config = this._getConfig(config)
- this._triggerArray = []
+ this._triggerArray = SelectorEngine.find(
+ `${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` +
+ `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`
+ )
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
@@ -86,10 +88,10 @@ class Collapse extends BaseComponent {
}
}
- this._initializeChildren()
+ this._parent = this._config.parent ? this._getParent() : null
if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())
+ this._addAriaAndCollapsedClass(this._element, this._triggerArray)
}
if (this._config.toggle) {
@@ -110,7 +112,7 @@ class Collapse extends BaseComponent {
// Public
toggle() {
- if (this._isShown()) {
+ if (this._element.classList.contains(CLASS_NAME_SHOW)) {
this.hide()
} else {
this.show()
@@ -118,20 +120,30 @@ class Collapse extends BaseComponent {
}
show() {
- if (this._isTransitioning || this._isShown()) {
+ if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
return
}
- let actives = []
+ let actives
let activesData
- if (this._config.parent) {
- const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent)
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)) // remove children if greater depth
+ if (this._parent) {
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent)
+ .filter(elem => {
+ if (typeof this._config.parent === 'string') {
+ return elem.getAttribute('data-bs-parent') === this._config.parent
+ }
+
+ return elem.classList.contains(CLASS_NAME_COLLAPSE)
+ })
+
+ if (actives.length === 0) {
+ actives = null
+ }
}
const container = SelectorEngine.findOne(this._selector)
- if (actives.length) {
+ if (actives) {
const tempActiveData = actives.find(elem => container !== elem)
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null
@@ -145,15 +157,17 @@ class Collapse extends BaseComponent {
return
}
- actives.forEach(elemActive => {
- if (container !== elemActive) {
- Collapse.getOrCreateInstance(elemActive, { toggle: false }).hide()
- }
+ if (actives) {
+ actives.forEach(elemActive => {
+ if (container !== elemActive) {
+ Collapse.collapseInterface(elemActive, 'hide')
+ }
- if (!activesData) {
- Data.set(elemActive, DATA_KEY, null)
- }
- })
+ if (!activesData) {
+ Data.set(elemActive, DATA_KEY, null)
+ }
+ })
+ }
const dimension = this._getDimension()
@@ -162,17 +176,23 @@ class Collapse extends BaseComponent {
this._element.style[dimension] = 0
- this._addAriaAndCollapsedClass(this._triggerArray, true)
- this._isTransitioning = true
+ if (this._triggerArray.length) {
+ this._triggerArray.forEach(element => {
+ element.classList.remove(CLASS_NAME_COLLAPSED)
+ element.setAttribute('aria-expanded', true)
+ })
+ }
+
+ this.setTransitioning(true)
const complete = () => {
- this._isTransitioning = false
-
this._element.classList.remove(CLASS_NAME_COLLAPSING)
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)
this._element.style[dimension] = ''
+ this.setTransitioning(false)
+
EventHandler.trigger(this._element, EVENT_SHOWN)
}
@@ -184,7 +204,7 @@ class Collapse extends BaseComponent {
}
hide() {
- if (this._isTransitioning || !this._isShown()) {
+ if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
return
}
@@ -203,19 +223,22 @@ class Collapse extends BaseComponent {
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)
const triggerArrayLength = this._triggerArray.length
- for (let i = 0; i < triggerArrayLength; i++) {
- const trigger = this._triggerArray[i]
- const elem = getElementFromSelector(trigger)
-
- if (elem && !this._isShown(elem)) {
- this._addAriaAndCollapsedClass([trigger], false)
+ if (triggerArrayLength > 0) {
+ for (let i = 0; i < triggerArrayLength; i++) {
+ const trigger = this._triggerArray[i]
+ const elem = getElementFromSelector(trigger)
+
+ if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
+ trigger.classList.add(CLASS_NAME_COLLAPSED)
+ trigger.setAttribute('aria-expanded', false)
+ }
}
}
- this._isTransitioning = true
+ this.setTransitioning(true)
const complete = () => {
- this._isTransitioning = false
+ this.setTransitioning(false)
this._element.classList.remove(CLASS_NAME_COLLAPSING)
this._element.classList.add(CLASS_NAME_COLLAPSE)
EventHandler.trigger(this._element, EVENT_HIDDEN)
@@ -226,8 +249,8 @@ class Collapse extends BaseComponent {
this._queueCallback(complete, this._element, true)
}
- _isShown(element = this._element) {
- return element.classList.contains(CLASS_NAME_SHOW)
+ setTransitioning(isTransitioning) {
+ this._isTransitioning = isTransitioning
}
// Private
@@ -235,40 +258,44 @@ class Collapse extends BaseComponent {
_getConfig(config) {
config = {
...Default,
- ...Manipulator.getDataAttributes(this._element),
...config
}
config.toggle = Boolean(config.toggle) // Coerce string values
- config.parent = getElement(config.parent)
typeCheckConfig(NAME, config, DefaultType)
return config
}
_getDimension() {
- return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT
+ return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT
}
- _initializeChildren() {
- if (!this._config.parent) {
- return
- }
+ _getParent() {
+ let { parent } = this._config
+
+ parent = getElement(parent)
+
+ const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`
- const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent)
- SelectorEngine.find(SELECTOR_DATA_TOGGLE, this._config.parent).filter(elem => !children.includes(elem))
+ SelectorEngine.find(selector, parent)
.forEach(element => {
const selected = getElementFromSelector(element)
- if (selected) {
- this._addAriaAndCollapsedClass([element], this._isShown(selected))
- }
+ this._addAriaAndCollapsedClass(
+ selected,
+ [element]
+ )
})
+
+ return parent
}
- _addAriaAndCollapsedClass(triggerArray, isOpen) {
- if (!triggerArray.length) {
+ _addAriaAndCollapsedClass(element, triggerArray) {
+ if (!element || !triggerArray.length) {
return
}
+ const isOpen = element.classList.contains(CLASS_NAME_SHOW)
+
triggerArray.forEach(elem => {
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED)
@@ -282,22 +309,34 @@ class Collapse extends BaseComponent {
// Static
- static jQueryInterface(config) {
- return this.each(function () {
- const _config = {}
- if (typeof config === 'string' && /show|hide/.test(config)) {
- _config.toggle = false
- }
+ static collapseInterface(element, config) {
+ let data = Collapse.getInstance(element)
+ const _config = {
+ ...Default,
+ ...Manipulator.getDataAttributes(element),
+ ...(typeof config === 'object' && config ? config : {})
+ }
- const data = Collapse.getOrCreateInstance(this, _config)
+ if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
+ _config.toggle = false
+ }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError(`No method named "${config}"`)
- }
+ if (!data) {
+ data = new Collapse(element, _config)
+ }
- data[config]()
+ if (typeof config === 'string') {
+ if (typeof data[config] === 'undefined') {
+ throw new TypeError(`No method named "${config}"`)
}
+
+ data[config]()
+ }
+ }
+
+ static jQueryInterface(config) {
+ return this.each(function () {
+ Collapse.collapseInterface(this, config)
})
}
}
@@ -314,11 +353,26 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
event.preventDefault()
}
+ const triggerData = Manipulator.getDataAttributes(this)
const selector = getSelectorFromElement(this)
const selectorElements = SelectorEngine.find(selector)
selectorElements.forEach(element => {
- Collapse.getOrCreateInstance(element, { toggle: false }).toggle()
+ const data = Collapse.getInstance(element)
+ let config
+ if (data) {
+ // update parent attribute
+ if (data._parent === null && typeof triggerData.parent === 'string') {
+ data._config.parent = triggerData.parent
+ data._parent = data._getParent()
+ }
+
+ config = 'toggle'
+ } else {
+ config = triggerData
+ }
+
+ Collapse.collapseInterface(element, config)
})
})
diff --git a/vendor/twbs/bootstrap/js/src/dom/data.js b/vendor/twbs/bootstrap/js/src/dom/data.js
index ee5b2c37d..cb88ef53d 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.1.1): dom/data.js
+ * Bootstrap (v5.0.2): 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 bf895dc6e..c8303f7f2 100644
--- a/vendor/twbs/bootstrap/js/src/dom/event-handler.js
+++ b/vendor/twbs/bootstrap/js/src/dom/event-handler.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/event-handler.js
+ * Bootstrap (v5.0.2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -113,6 +113,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
event.delegateTarget = target
if (handler.oneOff) {
+ // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, selector, fn)
}
diff --git a/vendor/twbs/bootstrap/js/src/dom/manipulator.js b/vendor/twbs/bootstrap/js/src/dom/manipulator.js
index 1be3a793f..113817bee 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.1.1): dom/manipulator.js
+ * Bootstrap (v5.0.2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -64,8 +64,8 @@ const Manipulator = {
const rect = element.getBoundingClientRect()
return {
- top: rect.top + window.pageYOffset,
- left: rect.left + window.pageXOffset
+ top: rect.top + document.body.scrollTop,
+ left: rect.left + document.body.scrollLeft
}
},
diff --git a/vendor/twbs/bootstrap/js/src/dom/selector-engine.js b/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
index 19e45c205..381e45fe8 100644
--- a/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
+++ b/vendor/twbs/bootstrap/js/src/dom/selector-engine.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/selector-engine.js
+ * Bootstrap (v5.0.2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -11,8 +11,6 @@
* ------------------------------------------------------------------------
*/
-import { isDisabled, isVisible } from '../util/index'
-
const NODE_TEXT = 3
const SelectorEngine = {
@@ -71,21 +69,6 @@ const SelectorEngine = {
}
return []
- },
-
- focusableChildren(element) {
- const focusables = [
- 'a',
- 'button',
- 'input',
- 'textarea',
- 'select',
- 'details',
- '[tabindex]',
- '[contenteditable="true"]'
- ].map(selector => `${selector}:not([tabindex^="-"])`).join(', ')
-
- return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))
}
}
diff --git a/vendor/twbs/bootstrap/js/src/dropdown.js b/vendor/twbs/bootstrap/js/src/dropdown.js
index 874cf907b..681369b48 100644
--- a/vendor/twbs/bootstrap/js/src/dropdown.js
+++ b/vendor/twbs/bootstrap/js/src/dropdown.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dropdown.js
+ * Bootstrap (v5.0.2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -11,12 +11,12 @@ import {
defineJQueryPlugin,
getElement,
getElementFromSelector,
- getNextActiveElement,
isDisabled,
isElement,
- isRTL,
isVisible,
+ isRTL,
noop,
+ getNextActiveElement,
typeCheckConfig
} from './util/index'
import EventHandler from './dom/event-handler'
@@ -48,6 +48,7 @@ const EVENT_HIDE = `hide${EVENT_KEY}`
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
+const EVENT_CLICK = `click${EVENT_KEY}`
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
@@ -102,6 +103,8 @@ class Dropdown extends BaseComponent {
this._config = this._getConfig(config)
this._menu = this._getMenuElement()
this._inNavbar = this._detectNavbar()
+
+ this._addEventListeners()
}
// Getters
@@ -121,14 +124,26 @@ class Dropdown extends BaseComponent {
// Public
toggle() {
- return this._isShown() ? this.hide() : this.show()
+ if (isDisabled(this._element)) {
+ return
+ }
+
+ const isActive = this._element.classList.contains(CLASS_NAME_SHOW)
+
+ if (isActive) {
+ this.hide()
+ return
+ }
+
+ this.show()
}
show() {
- if (isDisabled(this._element) || this._isShown(this._menu)) {
+ if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW)) {
return
}
+ const parent = Dropdown.getParentFromElement(this._element)
const relatedTarget = {
relatedTarget: this._element
}
@@ -139,12 +154,32 @@ class Dropdown extends BaseComponent {
return
}
- const parent = Dropdown.getParentFromElement(this._element)
// Totally disable Popper for Dropdowns in Navbar
if (this._inNavbar) {
Manipulator.setDataAttribute(this._menu, 'popper', 'none')
} else {
- this._createPopper(parent)
+ if (typeof Popper === 'undefined') {
+ throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)')
+ }
+
+ let referenceElement = this._element
+
+ if (this._config.reference === 'parent') {
+ referenceElement = parent
+ } else if (isElement(this._config.reference)) {
+ referenceElement = getElement(this._config.reference)
+ } else if (typeof this._config.reference === 'object') {
+ referenceElement = this._config.reference
+ }
+
+ const popperConfig = this._getPopperConfig()
+ const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false)
+
+ this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
+
+ if (isDisplayStatic) {
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static')
+ }
}
// If this is a touch-enabled device we add extra
@@ -160,13 +195,13 @@ class Dropdown extends BaseComponent {
this._element.focus()
this._element.setAttribute('aria-expanded', true)
- this._menu.classList.add(CLASS_NAME_SHOW)
- this._element.classList.add(CLASS_NAME_SHOW)
+ this._menu.classList.toggle(CLASS_NAME_SHOW)
+ this._element.classList.toggle(CLASS_NAME_SHOW)
EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)
}
hide() {
- if (isDisabled(this._element) || !this._isShown(this._menu)) {
+ if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW)) {
return
}
@@ -194,6 +229,13 @@ class Dropdown extends BaseComponent {
// Private
+ _addEventListeners() {
+ EventHandler.on(this._element, EVENT_CLICK, event => {
+ event.preventDefault()
+ this.toggle()
+ })
+ }
+
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)
if (hideEvent.defaultPrevented) {
@@ -237,35 +279,6 @@ class Dropdown extends BaseComponent {
return config
}
- _createPopper(parent) {
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)')
- }
-
- let referenceElement = this._element
-
- if (this._config.reference === 'parent') {
- referenceElement = parent
- } else if (isElement(this._config.reference)) {
- referenceElement = getElement(this._config.reference)
- } else if (typeof this._config.reference === 'object') {
- referenceElement = this._config.reference
- }
-
- const popperConfig = this._getPopperConfig()
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false)
-
- this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
-
- if (isDisplayStatic) {
- Manipulator.setDataAttribute(this._menu, 'popper', 'static')
- }
- }
-
- _isShown(element = this._element) {
- return element.classList.contains(CLASS_NAME_SHOW)
- }
-
_getMenuElement() {
return SelectorEngine.next(this._element, SELECTOR_MENU)[0]
}
@@ -354,19 +367,21 @@ class Dropdown extends BaseComponent {
// Static
- static jQueryInterface(config) {
- return this.each(function () {
- const data = Dropdown.getOrCreateInstance(this, config)
-
- if (typeof config !== 'string') {
- return
- }
+ static dropdownInterface(element, config) {
+ const data = Dropdown.getOrCreateInstance(element, config)
+ if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
+ }
+ }
+
+ static jQueryInterface(config) {
+ return this.each(function () {
+ Dropdown.dropdownInterface(this, config)
})
}
@@ -383,7 +398,7 @@ class Dropdown extends BaseComponent {
continue
}
- if (!context._isShown()) {
+ if (!context._element.classList.contains(CLASS_NAME_SHOW)) {
continue
}
@@ -449,20 +464,20 @@ class Dropdown extends BaseComponent {
return
}
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]
- const instance = Dropdown.getOrCreateInstance(getToggleButton)
+ const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]
if (event.key === ESCAPE_KEY) {
- instance.hide()
+ getToggleButton().focus()
+ Dropdown.clearMenus()
return
}
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
if (!isActive) {
- instance.show()
+ getToggleButton().click()
}
- instance._selectMenuItem(event)
+ Dropdown.getInstance(getToggleButton())._selectMenuItem(event)
return
}
@@ -484,7 +499,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault()
- Dropdown.getOrCreateInstance(this).toggle()
+ Dropdown.dropdownInterface(this)
})
/**
diff --git a/vendor/twbs/bootstrap/js/src/modal.js b/vendor/twbs/bootstrap/js/src/modal.js
index b4700f02a..8dac75265 100644
--- a/vendor/twbs/bootstrap/js/src/modal.js
+++ b/vendor/twbs/bootstrap/js/src/modal.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): modal.js
+ * Bootstrap (v5.0.2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -19,8 +19,6 @@ 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'
/**
* ------------------------------------------------------------------------
@@ -51,6 +49,7 @@ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
+const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
const EVENT_RESIZE = `resize${EVENT_KEY}`
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`
@@ -63,10 +62,10 @@ const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_STATIC = 'modal-static'
-const OPEN_SELECTOR = '.modal.show'
const SELECTOR_DIALOG = '.modal-dialog'
const SELECTOR_MODAL_BODY = '.modal-body'
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]'
+const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]'
/**
* ------------------------------------------------------------------------
@@ -81,7 +80,6 @@ class Modal extends BaseComponent {
this._config = this._getConfig(config)
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)
this._backdrop = this._initializeBackDrop()
- this._focustrap = this._initializeFocusTrap()
this._isShown = false
this._ignoreBackdropClick = false
this._isTransitioning = false
@@ -132,6 +130,8 @@ class Modal extends BaseComponent {
this._setEscapeEvent()
this._setResizeEvent()
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, event => this.hide(event))
+
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
if (event.target === this._element) {
@@ -143,7 +143,11 @@ class Modal extends BaseComponent {
this._showBackdrop(() => this._showElement(relatedTarget))
}
- hide() {
+ hide(event) {
+ if (event && ['A', 'AREA'].includes(event.target.tagName)) {
+ event.preventDefault()
+ }
+
if (!this._isShown || this._isTransitioning) {
return
}
@@ -164,7 +168,7 @@ class Modal extends BaseComponent {
this._setEscapeEvent()
this._setResizeEvent()
- this._focustrap.deactivate()
+ EventHandler.off(document, EVENT_FOCUSIN)
this._element.classList.remove(CLASS_NAME_SHOW)
@@ -179,8 +183,14 @@ class Modal extends BaseComponent {
.forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY))
this._backdrop.dispose()
- this._focustrap.deactivate()
super.dispose()
+
+ /**
+ * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
+ * Do not move `document` in `htmlElements` array
+ * It will remove `EVENT_CLICK_DATA_API` event that should remain
+ */
+ EventHandler.off(document, EVENT_FOCUSIN)
}
handleUpdate() {
@@ -196,12 +206,6 @@ class Modal extends BaseComponent {
})
}
- _initializeFocusTrap() {
- return new FocusTrap({
- trapElement: this._element
- })
- }
-
_getConfig(config) {
config = {
...Default,
@@ -218,7 +222,7 @@ class Modal extends BaseComponent {
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// Don't move modal's DOM position
- document.body.append(this._element)
+ document.body.appendChild(this._element)
}
this._element.style.display = 'block'
@@ -237,9 +241,13 @@ class Modal extends BaseComponent {
this._element.classList.add(CLASS_NAME_SHOW)
+ if (this._config.focus) {
+ this._enforceFocus()
+ }
+
const transitionComplete = () => {
if (this._config.focus) {
- this._focustrap.activate()
+ this._element.focus()
}
this._isTransitioning = false
@@ -251,6 +259,17 @@ class Modal extends BaseComponent {
this._queueCallback(transitionComplete, this._dialog, isAnimated)
}
+ _enforceFocus() {
+ EventHandler.off(document, EVENT_FOCUSIN) // guard against infinite focus loop
+ EventHandler.on(document, EVENT_FOCUSIN, event => {
+ if (document !== event.target &&
+ this._element !== event.target &&
+ !this._element.contains(event.target)) {
+ this._element.focus()
+ }
+ })
+ }
+
_setEscapeEvent() {
if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
@@ -412,19 +431,11 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
})
})
- // avoid conflict when clicking moddal toggler while another one is open
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)
- if (allReadyOpen) {
- Modal.getInstance(allReadyOpen).hide()
- }
-
const data = Modal.getOrCreateInstance(target)
data.toggle(this)
})
-enableDismissTrigger(Modal)
-
/**
* ------------------------------------------------------------------------
* jQuery
diff --git a/vendor/twbs/bootstrap/js/src/offcanvas.js b/vendor/twbs/bootstrap/js/src/offcanvas.js
index 57bf2e897..88eb8c997 100644
--- a/vendor/twbs/bootstrap/js/src/offcanvas.js
+++ b/vendor/twbs/bootstrap/js/src/offcanvas.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): offcanvas.js
+ * Bootstrap (v5.0.2): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -18,8 +18,6 @@ import BaseComponent from './base-component'
import SelectorEngine from './dom/selector-engine'
import Manipulator from './dom/manipulator'
import Backdrop from './util/backdrop'
-import FocusTrap from './util/focustrap'
-import { enableDismissTrigger } from './util/component-functions'
/**
* ------------------------------------------------------------------------
@@ -47,16 +45,18 @@ const DefaultType = {
}
const CLASS_NAME_SHOW = 'show'
-const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'
const OPEN_SELECTOR = '.offcanvas.show'
const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const EVENT_HIDE = `hide${EVENT_KEY}`
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
+const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
+const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`
+const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]'
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]'
/**
@@ -72,7 +72,6 @@ class Offcanvas extends BaseComponent {
this._config = this._getConfig(config)
this._isShown = false
this._backdrop = this._initializeBackDrop()
- this._focustrap = this._initializeFocusTrap()
this._addEventListeners()
}
@@ -110,6 +109,7 @@ class Offcanvas extends BaseComponent {
if (!this._config.scroll) {
new ScrollBarHelper().hide()
+ this._enforceFocusOnElement(this._element)
}
this._element.removeAttribute('aria-hidden')
@@ -118,10 +118,6 @@ class Offcanvas extends BaseComponent {
this._element.classList.add(CLASS_NAME_SHOW)
const completeCallBack = () => {
- if (!this._config.scroll) {
- this._focustrap.activate()
- }
-
EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })
}
@@ -139,7 +135,7 @@ class Offcanvas extends BaseComponent {
return
}
- this._focustrap.deactivate()
+ EventHandler.off(document, EVENT_FOCUSIN)
this._element.blur()
this._isShown = false
this._element.classList.remove(CLASS_NAME_SHOW)
@@ -163,8 +159,8 @@ class Offcanvas extends BaseComponent {
dispose() {
this._backdrop.dispose()
- this._focustrap.deactivate()
super.dispose()
+ EventHandler.off(document, EVENT_FOCUSIN)
}
// Private
@@ -181,7 +177,6 @@ class Offcanvas extends BaseComponent {
_initializeBackDrop() {
return new Backdrop({
- className: CLASS_NAME_BACKDROP,
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
@@ -189,13 +184,21 @@ class Offcanvas extends BaseComponent {
})
}
- _initializeFocusTrap() {
- return new FocusTrap({
- trapElement: this._element
+ _enforceFocusOnElement(element) {
+ EventHandler.off(document, EVENT_FOCUSIN) // guard against infinite focus loop
+ EventHandler.on(document, EVENT_FOCUSIN, event => {
+ if (document !== event.target &&
+ element !== event.target &&
+ !element.contains(event.target)) {
+ element.focus()
+ }
})
+ element.focus()
}
_addEventListeners() {
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
+
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide()
@@ -260,7 +263,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () =>
SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show())
)
-enableDismissTrigger(Offcanvas)
/**
* ------------------------------------------------------------------------
* jQuery
diff --git a/vendor/twbs/bootstrap/js/src/popover.js b/vendor/twbs/bootstrap/js/src/popover.js
index 71c50daf9..5a3b32631 100644
--- a/vendor/twbs/bootstrap/js/src/popover.js
+++ b/vendor/twbs/bootstrap/js/src/popover.js
@@ -1,11 +1,12 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): popover.js
+ * Bootstrap (v5.0.2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import { defineJQueryPlugin } from './util/index'
+import SelectorEngine from './dom/selector-engine'
import Tooltip from './tooltip'
/**
@@ -18,6 +19,7 @@ const NAME = 'popover'
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-popover'
+const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const Default = {
...Tooltip.Default,
@@ -50,6 +52,9 @@ const Event = {
MOUSELEAVE: `mouseleave${EVENT_KEY}`
}
+const CLASS_NAME_FADE = 'fade'
+const CLASS_NAME_SHOW = 'show'
+
const SELECTOR_TITLE = '.popover-header'
const SELECTOR_CONTENT = '.popover-body'
@@ -84,19 +89,56 @@ class Popover extends Tooltip {
return this.getTitle() || this._getContent()
}
- setContent(tip) {
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE)
- this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT)
+ getTipElement() {
+ if (this.tip) {
+ return this.tip
+ }
+
+ this.tip = super.getTipElement()
+
+ if (!this.getTitle()) {
+ SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove()
+ }
+
+ if (!this._getContent()) {
+ SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove()
+ }
+
+ return this.tip
+ }
+
+ setContent() {
+ const tip = this.getTipElement()
+
+ // we use append for html objects to maintain js events
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle())
+ let content = this._getContent()
+ if (typeof content === 'function') {
+ content = content.call(this._element)
+ }
+
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content)
+
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
}
// Private
+ _addAttachmentClass(attachment) {
+ this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
+ }
+
_getContent() {
- return this._resolvePossibleFunction(this._config.content)
+ return this._element.getAttribute('data-bs-content') || this._config.content
}
- _getBasicClassPrefix() {
- return CLASS_PREFIX
+ _cleanTipClass() {
+ const tip = this.getTipElement()
+ const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
+ if (tabClass !== null && tabClass.length > 0) {
+ tabClass.map(token => token.trim())
+ .forEach(tClass => tip.classList.remove(tClass))
+ }
}
// Static
diff --git a/vendor/twbs/bootstrap/js/src/scrollspy.js b/vendor/twbs/bootstrap/js/src/scrollspy.js
index 6ac00fedd..e2c432ca3 100644
--- a/vendor/twbs/bootstrap/js/src/scrollspy.js
+++ b/vendor/twbs/bootstrap/js/src/scrollspy.js
@@ -1,14 +1,15 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): scrollspy.js
+ * Bootstrap (v5.0.2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
- getElement,
getSelectorFromElement,
+ getUID,
+ isElement,
typeCheckConfig
} from './util/index'
import EventHandler from './dom/event-handler'
@@ -51,7 +52,6 @@ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'
const SELECTOR_NAV_LINKS = '.nav-link'
const SELECTOR_NAV_ITEMS = '.nav-item'
const SELECTOR_LIST_ITEMS = '.list-group-item'
-const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`
const SELECTOR_DROPDOWN = '.dropdown'
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
@@ -69,6 +69,7 @@ class ScrollSpy extends BaseComponent {
super(element)
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element
this._config = this._getConfig(config)
+ this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`
this._offsets = []
this._targets = []
this._activeTarget = null
@@ -109,7 +110,7 @@ class ScrollSpy extends BaseComponent {
this._targets = []
this._scrollHeight = this._getScrollHeight()
- const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
+ const targets = SelectorEngine.find(this._selector)
targets.map(element => {
const targetSelector = getSelectorFromElement(element)
@@ -149,7 +150,15 @@ class ScrollSpy extends BaseComponent {
...(typeof config === 'object' && config ? config : {})
}
- config.target = getElement(config.target) || document.documentElement
+ if (typeof config.target !== 'string' && isElement(config.target)) {
+ let { id } = config.target
+ if (!id) {
+ id = getUID(NAME)
+ config.target.id = id
+ }
+
+ config.target = `#${id}`
+ }
typeCheckConfig(NAME, config, DefaultType)
@@ -216,16 +225,20 @@ class ScrollSpy extends BaseComponent {
this._clear()
- const queries = SELECTOR_LINK_ITEMS.split(',')
+ const queries = this._selector.split(',')
.map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`)
- const link = SelectorEngine.findOne(queries.join(','), this._config.target)
+ const link = SelectorEngine.findOne(queries.join(','))
- link.classList.add(CLASS_NAME_ACTIVE)
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN))
.classList.add(CLASS_NAME_ACTIVE)
+
+ link.classList.add(CLASS_NAME_ACTIVE)
} else {
+ // Set triggered link as active
+ link.classList.add(CLASS_NAME_ACTIVE)
+
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP)
.forEach(listGroup => {
// Set triggered links parents as active
@@ -248,7 +261,7 @@ class ScrollSpy extends BaseComponent {
}
_clear() {
- SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
+ SelectorEngine.find(this._selector)
.filter(node => node.classList.contains(CLASS_NAME_ACTIVE))
.forEach(node => node.classList.remove(CLASS_NAME_ACTIVE))
}
diff --git a/vendor/twbs/bootstrap/js/src/tab.js b/vendor/twbs/bootstrap/js/src/tab.js
index 161bccbca..ff12efe2e 100644
--- a/vendor/twbs/bootstrap/js/src/tab.js
+++ b/vendor/twbs/bootstrap/js/src/tab.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): tab.js
+ * Bootstrap (v5.0.2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/toast.js b/vendor/twbs/bootstrap/js/src/toast.js
index 8a7fcdc71..b6c9bdd79 100644
--- a/vendor/twbs/bootstrap/js/src/toast.js
+++ b/vendor/twbs/bootstrap/js/src/toast.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): toast.js
+ * Bootstrap (v5.0.2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -13,7 +13,6 @@ import {
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import BaseComponent from './base-component'
-import { enableDismissTrigger } from './util/component-functions'
/**
* ------------------------------------------------------------------------
@@ -25,6 +24,7 @@ const NAME = 'toast'
const DATA_KEY = 'bs.toast'
const EVENT_KEY = `.${DATA_KEY}`
+const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
@@ -35,7 +35,7 @@ const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const CLASS_NAME_FADE = 'fade'
-const CLASS_NAME_HIDE = 'hide' // @deprecated - kept here only for backwards compatibility
+const CLASS_NAME_HIDE = 'hide'
const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_SHOWING = 'showing'
@@ -51,6 +51,8 @@ const Default = {
delay: 5000
}
+const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'
+
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -99,14 +101,15 @@ class Toast extends BaseComponent {
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING)
+ this._element.classList.add(CLASS_NAME_SHOW)
+
EventHandler.trigger(this._element, EVENT_SHOWN)
this._maybeScheduleHide()
}
- this._element.classList.remove(CLASS_NAME_HIDE) // @deprecated
+ this._element.classList.remove(CLASS_NAME_HIDE)
reflow(this._element)
- this._element.classList.add(CLASS_NAME_SHOW)
this._element.classList.add(CLASS_NAME_SHOWING)
this._queueCallback(complete, this._element, this._config.animation)
@@ -124,13 +127,11 @@ class Toast extends BaseComponent {
}
const complete = () => {
- this._element.classList.add(CLASS_NAME_HIDE) // @deprecated
- this._element.classList.remove(CLASS_NAME_SHOWING)
- this._element.classList.remove(CLASS_NAME_SHOW)
+ this._element.classList.add(CLASS_NAME_HIDE)
EventHandler.trigger(this._element, EVENT_HIDDEN)
}
- this._element.classList.add(CLASS_NAME_SHOWING)
+ this._element.classList.remove(CLASS_NAME_SHOW)
this._queueCallback(complete, this._element, this._config.animation)
}
@@ -200,6 +201,7 @@ class Toast extends BaseComponent {
}
_setListeners() {
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true))
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false))
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true))
@@ -228,8 +230,6 @@ class Toast extends BaseComponent {
}
}
-enableDismissTrigger(Toast)
-
/**
* ------------------------------------------------------------------------
* jQuery
diff --git a/vendor/twbs/bootstrap/js/src/tooltip.js b/vendor/twbs/bootstrap/js/src/tooltip.js
index 747555411..cd4a2878e 100644
--- a/vendor/twbs/bootstrap/js/src/tooltip.js
+++ b/vendor/twbs/bootstrap/js/src/tooltip.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): tooltip.js
+ * Bootstrap (v5.0.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -17,7 +17,10 @@ import {
noop,
typeCheckConfig
} from './util/index'
-import { DefaultAllowlist, sanitizeHtml } from './util/sanitizer'
+import {
+ DefaultAllowlist,
+ sanitizeHtml
+} from './util/sanitizer'
import Data from './dom/data'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
@@ -34,6 +37,7 @@ const NAME = 'tooltip'
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-tooltip'
+const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
const DefaultType = {
@@ -108,9 +112,6 @@ const HOVER_STATE_SHOW = 'show'
const HOVER_STATE_OUT = 'out'
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'
-const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`
-
-const EVENT_MODAL_HIDE = 'hide.bs.modal'
const TRIGGER_HOVER = 'hover'
const TRIGGER_FOCUS = 'focus'
@@ -205,13 +206,16 @@ class Tooltip extends BaseComponent {
dispose() {
clearTimeout(this._timeout)
- EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
+ EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
if (this.tip) {
this.tip.remove()
}
- this._disposePopper()
+ if (this._popper) {
+ this._popper.destroy()
+ }
+
super.dispose()
}
@@ -234,20 +238,14 @@ class Tooltip extends BaseComponent {
return
}
- // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
- // This will be removed later in favor of a `setContent` method
- if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
- this._disposePopper()
- this.tip.remove()
- this.tip = null
- }
-
const tip = this.getTipElement()
const tipId = getUID(this.constructor.NAME)
tip.setAttribute('id', tipId)
this._element.setAttribute('aria-describedby', tipId)
+ this.setContent()
+
if (this._config.animation) {
tip.classList.add(CLASS_NAME_FADE)
}
@@ -263,7 +261,7 @@ class Tooltip extends BaseComponent {
Data.set(tip, this.constructor.DATA_KEY, this)
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.append(tip)
+ container.appendChild(tip)
EventHandler.trigger(this._element, this.constructor.Event.INSERTED)
}
@@ -275,7 +273,7 @@ class Tooltip extends BaseComponent {
tip.classList.add(CLASS_NAME_SHOW)
- const customClass = this._resolvePossibleFunction(this._config.customClass)
+ const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass
if (customClass) {
tip.classList.add(...customClass.split(' '))
}
@@ -324,7 +322,10 @@ class Tooltip extends BaseComponent {
this._element.removeAttribute('aria-describedby')
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
- this._disposePopper()
+ if (this._popper) {
+ this._popper.destroy()
+ this._popper = null
+ }
}
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)
@@ -370,28 +371,14 @@ class Tooltip extends BaseComponent {
const element = document.createElement('div')
element.innerHTML = this._config.template
- const tip = element.children[0]
- this.setContent(tip)
- tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
-
- this.tip = tip
+ this.tip = element.children[0]
return this.tip
}
- setContent(tip) {
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER)
- }
-
- _sanitizeAndSetContent(template, content, selector) {
- const templateElement = SelectorEngine.findOne(selector, template)
-
- if (!content && templateElement) {
- templateElement.remove()
- return
- }
-
- // we use append for html objects to maintain js events
- this.setElementContent(templateElement, content)
+ setContent() {
+ const tip = this.getTipElement()
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle())
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
}
setElementContent(element, content) {
@@ -406,7 +393,7 @@ class Tooltip extends BaseComponent {
if (this._config.html) {
if (content.parentNode !== element) {
element.innerHTML = ''
- element.append(content)
+ element.appendChild(content)
}
} else {
element.textContent = content.textContent
@@ -427,9 +414,15 @@ class Tooltip extends BaseComponent {
}
getTitle() {
- const title = this._element.getAttribute('data-bs-original-title') || this._config.title
+ let 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
+ }
- return this._resolvePossibleFunction(title)
+ return title
}
updateAttachment(attachment) {
@@ -447,7 +440,15 @@ class Tooltip extends BaseComponent {
// Private
_initializeOnDelegatedTarget(event, context) {
- return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())
+ const dataKey = this.constructor.DATA_KEY
+ context = context || Data.get(event.delegateTarget, dataKey)
+
+ if (!context) {
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig())
+ Data.set(event.delegateTarget, dataKey, context)
+ }
+
+ return context
}
_getOffset() {
@@ -464,10 +465,6 @@ class Tooltip extends BaseComponent {
return offset
}
- _resolvePossibleFunction(content) {
- return typeof content === 'function' ? content.call(this._element) : content
- }
-
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
@@ -517,7 +514,7 @@ class Tooltip extends BaseComponent {
}
_addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`)
+ this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
}
_getAttachment(placement) {
@@ -549,7 +546,7 @@ class Tooltip extends BaseComponent {
}
}
- EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
+ EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
if (this._config.selector) {
this._config = {
@@ -689,32 +686,26 @@ 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]
+ if (this._config) {
+ for (const key in this._config) {
+ if (this.constructor.Default[key] !== this._config[key]) {
+ config[key] = this._config[key]
+ }
}
}
- // In the future can be replaced with:
- // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
- // `Object.fromEntries(keysWithDifferentValues)`
return config
}
_cleanTipClass() {
const tip = this.getTipElement()
- const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g')
- const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex)
+ const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
if (tabClass !== null && tabClass.length > 0) {
tabClass.map(token => token.trim())
.forEach(tClass => tip.classList.remove(tClass))
}
}
- _getBasicClassPrefix() {
- return CLASS_PREFIX
- }
-
_handlePopperPlacementChange(popperData) {
const { state } = popperData
@@ -727,13 +718,6 @@ class Tooltip extends BaseComponent {
this._addAttachmentClass(this._getAttachment(state.placement))
}
- _disposePopper() {
- if (this._popper) {
- this._popper.destroy()
- this._popper = null
- }
- }
-
// Static
static jQueryInterface(config) {
diff --git a/vendor/twbs/bootstrap/js/src/util/backdrop.js b/vendor/twbs/bootstrap/js/src/util/backdrop.js
index e98d80707..7ba7b4c43 100644
--- a/vendor/twbs/bootstrap/js/src/util/backdrop.js
+++ b/vendor/twbs/bootstrap/js/src/util/backdrop.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/backdrop.js
+ * Bootstrap (v5.0.2): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -9,7 +9,6 @@ import EventHandler from '../dom/event-handler'
import { execute, executeAfterTransition, getElement, reflow, typeCheckConfig } from './index'
const Default = {
- className: 'modal-backdrop',
isVisible: true, // if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: 'body', // give the choice to place backdrop under different elements
@@ -17,13 +16,13 @@ const Default = {
}
const DefaultType = {
- className: 'string',
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: '(element|string)',
clickCallback: '(function|null)'
}
const NAME = 'backdrop'
+const CLASS_NAME_BACKDROP = 'modal-backdrop'
const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
@@ -74,7 +73,7 @@ class Backdrop {
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div')
- backdrop.className = this._config.className
+ backdrop.className = CLASS_NAME_BACKDROP
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE)
}
@@ -102,7 +101,7 @@ class Backdrop {
return
}
- this._config.rootElement.append(this._getElement())
+ this._config.rootElement.appendChild(this._getElement())
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback)
diff --git a/vendor/twbs/bootstrap/js/src/util/component-functions.js b/vendor/twbs/bootstrap/js/src/util/component-functions.js
deleted file mode 100644
index ff9d87ee6..000000000
--- a/vendor/twbs/bootstrap/js/src/util/component-functions.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): 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'
-
-const enableDismissTrigger = (component, method = 'hide') => {
- const clickEvent = `click.dismiss${component.EVENT_KEY}`
- const name = component.NAME
-
- EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
- if (['A', 'AREA'].includes(this.tagName)) {
- event.preventDefault()
- }
-
- if (isDisabled(this)) {
- return
- }
-
- const target = 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
- instance[method]()
- })
-}
-
-export {
- enableDismissTrigger
-}
diff --git a/vendor/twbs/bootstrap/js/src/util/focustrap.js b/vendor/twbs/bootstrap/js/src/util/focustrap.js
deleted file mode 100644
index ca6f8273f..000000000
--- a/vendor/twbs/bootstrap/js/src/util/focustrap.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/focustrap.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
- */
-
-import EventHandler from '../dom/event-handler'
-import SelectorEngine from '../dom/selector-engine'
-import { typeCheckConfig } from './index'
-
-const Default = {
- trapElement: null, // The element to trap focus inside of
- autofocus: true
-}
-
-const DefaultType = {
- trapElement: 'element',
- autofocus: 'boolean'
-}
-
-const NAME = 'focustrap'
-const DATA_KEY = 'bs.focustrap'
-const EVENT_KEY = `.${DATA_KEY}`
-const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
-const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`
-
-const TAB_KEY = 'Tab'
-const TAB_NAV_FORWARD = 'forward'
-const TAB_NAV_BACKWARD = 'backward'
-
-class FocusTrap {
- constructor(config) {
- this._config = this._getConfig(config)
- this._isActive = false
- this._lastTabNavDirection = null
- }
-
- activate() {
- const { trapElement, autofocus } = this._config
-
- if (this._isActive) {
- return
- }
-
- if (autofocus) {
- trapElement.focus()
- }
-
- EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
- EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))
- EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))
-
- this._isActive = true
- }
-
- deactivate() {
- if (!this._isActive) {
- return
- }
-
- this._isActive = false
- EventHandler.off(document, EVENT_KEY)
- }
-
- // Private
-
- _handleFocusin(event) {
- const { target } = event
- const { trapElement } = this._config
-
- if (
- target === document ||
- target === trapElement ||
- trapElement.contains(target)
- ) {
- return
- }
-
- const elements = SelectorEngine.focusableChildren(trapElement)
-
- if (elements.length === 0) {
- trapElement.focus()
- } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
- elements[elements.length - 1].focus()
- } else {
- elements[0].focus()
- }
- }
-
- _handleKeydown(event) {
- if (event.key !== TAB_KEY) {
- return
- }
-
- this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD
- }
-
- _getConfig(config) {
- config = {
- ...Default,
- ...(typeof config === 'object' ? config : {})
- }
- typeCheckConfig(NAME, config, DefaultType)
- return config
- }
-}
-
-export default FocusTrap
diff --git a/vendor/twbs/bootstrap/js/src/util/index.js b/vendor/twbs/bootstrap/js/src/util/index.js
index a4ad9c941..7c317b016 100644
--- a/vendor/twbs/bootstrap/js/src/util/index.js
+++ b/vendor/twbs/bootstrap/js/src/util/index.js
@@ -1,6 +1,8 @@
+import SelectorEngine from '../dom/selector-engine'
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/index.js
+ * Bootstrap (v5.0.2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -118,7 +120,7 @@ const getElement = obj => {
}
if (typeof obj === 'string' && obj.length > 0) {
- return document.querySelector(obj)
+ return SelectorEngine.findOne(obj)
}
return null
@@ -187,18 +189,7 @@ const findShadowRoot = element => {
const noop = () => {}
-/**
- * Trick to restart an element's animation
- *
- * @param {HTMLElement} element
- * @return void
- *
- * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
- */
-const reflow = element => {
- // eslint-disable-next-line no-unused-expressions
- element.offsetHeight
-}
+const reflow = element => element.offsetHeight
const getjQuery = () => {
const { jQuery } = window
diff --git a/vendor/twbs/bootstrap/js/src/util/sanitizer.js b/vendor/twbs/bootstrap/js/src/util/sanitizer.js
index 467dbf96a..49f66417d 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.1.1): util/sanitizer.js
+ * Bootstrap (v5.0.2): 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 73c28254e..fad9766ac 100644
--- a/vendor/twbs/bootstrap/js/src/util/scrollbar.js
+++ b/vendor/twbs/bootstrap/js/src/util/scrollbar.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/scrollBar.js
+ * Bootstrap (v5.0.2): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/