assets/javascripts/bootstrap.js in bootstrap-5.2.0 vs assets/javascripts/bootstrap.js in bootstrap-5.2.1
- old
+ new
@@ -1,7 +1,7 @@
/*!
- * Bootstrap v5.2.0 (https://getbootstrap.com/)
+ * Bootstrap v5.2.1 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) :
@@ -29,11 +29,11 @@
const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/index.js
+ * Bootstrap (v5.2.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MAX_UID = 1000000;
const MILLISECONDS_MULTIPLIER = 1000;
@@ -344,11 +344,11 @@
return list[Math.max(0, Math.min(index, listLength - 1))];
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): dom/event-handler.js
+ * Bootstrap (v5.2.1): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -613,11 +613,11 @@
return obj;
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): dom/data.js
+ * Bootstrap (v5.2.1): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
@@ -665,11 +665,11 @@
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): dom/manipulator.js
+ * Bootstrap (v5.2.1): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
function normalizeData(value) {
if (value === 'true') {
@@ -735,11 +735,11 @@
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/config.js
+ * Bootstrap (v5.2.1): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Class definition
@@ -796,19 +796,19 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): base-component.js
+ * Bootstrap (v5.2.1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
*/
- const VERSION = '5.2.0';
+ const VERSION = '5.2.1';
/**
* Class definition
*/
class BaseComponent extends Config {
@@ -875,11 +875,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/component-functions.js
+ * Bootstrap (v5.2.1): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const enableDismissTrigger = (component, method = 'hide') => {
@@ -901,11 +901,11 @@
});
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): alert.js
+ * Bootstrap (v5.2.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -981,11 +981,11 @@
defineJQueryPlugin(Alert);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): button.js
+ * Bootstrap (v5.2.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -1043,11 +1043,11 @@
defineJQueryPlugin(Button);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): dom/selector-engine.js
+ * Bootstrap (v5.2.1): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -1114,11 +1114,11 @@
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/swipe.js
+ * Bootstrap (v5.2.1): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -1250,11 +1250,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): carousel.js
+ * Bootstrap (v5.2.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -1698,11 +1698,11 @@
defineJQueryPlugin(Carousel);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): collapse.js
+ * Bootstrap (v5.2.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -1988,11 +1988,11 @@
defineJQueryPlugin(Collapse);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): dropdown.js
+ * Bootstrap (v5.2.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -2058,12 +2058,13 @@
class Dropdown extends BaseComponent {
constructor(element, config) {
super(element, config);
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/
- this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent);
+ this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0];
this._inNavbar = this._detectNavbar();
} // Getters
static get Default() {
@@ -2375,12 +2376,13 @@
if (isInput && !isEscapeEvent) {
return;
}
- event.preventDefault();
- const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
+ event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
+
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0];
const instance = Dropdown.getOrCreateInstance(getToggleButton);
if (isUpOrDownEvent) {
event.stopPropagation();
instance.show();
@@ -2418,11 +2420,11 @@
defineJQueryPlugin(Dropdown);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/scrollBar.js
+ * Bootstrap (v5.2.1): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -2537,11 +2539,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/backdrop.js
+ * Bootstrap (v5.2.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -2683,11 +2685,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/focustrap.js
+ * Bootstrap (v5.2.1): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -2792,11 +2794,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): modal.js
+ * Bootstrap (v5.2.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -2811,10 +2813,11 @@
const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
const CLASS_NAME_OPEN = 'modal-open';
const CLASS_NAME_FADE$3 = 'fade';
@@ -3003,24 +3006,26 @@
if (this._isShown && !this._isTransitioning) {
this._adjustDialog();
}
});
EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
- if (event.target !== event.currentTarget) {
- // click is inside modal-dialog
- return;
- }
+ EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
+ // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
+ if (this._dialog.contains(event.target) || this._dialog.contains(event2.target)) {
+ return;
+ }
- if (this._config.backdrop === 'static') {
- this._triggerBackdropTransition();
+ if (this._config.backdrop === 'static') {
+ this._triggerBackdropTransition();
- return;
- }
+ return;
+ }
- if (this._config.backdrop) {
- this.hide();
- }
+ if (this._config.backdrop) {
+ this.hide();
+ }
+ });
});
}
_hideModal() {
this._element.style.display = 'none';
@@ -3165,11 +3170,11 @@
defineJQueryPlugin(Modal);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): offcanvas.js
+ * Bootstrap (v5.2.1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -3439,11 +3444,11 @@
defineJQueryPlugin(Offcanvas);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/sanitizer.js
+ * Bootstrap (v5.2.1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
@@ -3544,11 +3549,11 @@
return createdDocument.body.innerHTML;
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): util/template-factory.js
+ * Bootstrap (v5.2.1): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -3702,11 +3707,11 @@
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): tooltip.js
+ * Bootstrap (v5.2.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -3791,11 +3796,11 @@
super(element, config); // Private
this._isEnabled = true;
this._timeout = 0;
- this._isHovered = false;
+ this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
this._templateFactory = null;
this._newContent = null; // Protected
@@ -3864,10 +3869,14 @@
if (this.tip) {
this.tip.remove();
}
+ if (this._config.originalTitle) {
+ this._element.setAttribute('title', this._config.originalTitle);
+ }
+
this._disposePopper();
super.dispose();
}
@@ -3924,17 +3933,17 @@
EventHandler.on(element, 'mouseover', noop);
}
}
const complete = () => {
- const previousHoverState = this._isHovered;
- this._isHovered = false;
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
- if (previousHoverState) {
+ if (this._isHovered === false) {
this._leave();
}
+
+ this._isHovered = false;
};
this._queueCallback(complete, this.tip, this._isAnimated());
}
@@ -3961,11 +3970,11 @@
}
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
- this._isHovered = false;
+ this._isHovered = null; // it is a trick to support manual triggering
const complete = () => {
if (this._isWithActiveTrigger()) {
return;
}
@@ -4324,11 +4333,11 @@
defineJQueryPlugin(Tooltip);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): popover.js
+ * Bootstrap (v5.2.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -4407,11 +4416,11 @@
defineJQueryPlugin(Popover);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): scrollspy.js
+ * Bootstrap (v5.2.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -4438,18 +4447,20 @@
const Default$1 = {
offset: null,
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: '0px 0px -25%',
smoothScroll: false,
- target: null
+ target: null,
+ threshold: [0.1, 0.5, 1]
};
const DefaultType$1 = {
offset: '(number|null)',
// TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: 'string',
smoothScroll: 'boolean',
- target: 'element'
+ target: 'element',
+ threshold: 'array'
};
/**
* Class definition
*/
@@ -4506,11 +4517,18 @@
} // Private
_configAfterMerge(config) {
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
- config.target = getElement(config.target) || document.body;
+ config.target = getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
+
+ config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
+
+ if (typeof config.threshold === 'string') {
+ config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
+ }
+
return config;
}
_maybeEnableSmoothScroll() {
if (!this._config.smoothScroll) {
@@ -4542,12 +4560,12 @@
}
_getNewObserver() {
const options = {
root: this._rootElement,
- threshold: [0.1, 0.5, 1],
- rootMargin: this._getRootMargin()
+ threshold: this._config.threshold,
+ rootMargin: this._config.rootMargin
};
return new IntersectionObserver(entries => this._observerCallback(entries), options);
} // The logic of selection
@@ -4588,15 +4606,10 @@
if (!userScrollsDown && !entryIsLowerThanPrevious) {
activate(entry);
}
}
- } // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
-
-
- _getRootMargin() {
- return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
}
_initializeTargetsAndObservables() {
this._targetLinks = new Map();
this._observableSections = new Map();
@@ -4694,11 +4707,11 @@
defineJQueryPlugin(ScrollSpy);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): tab.js
+ * Bootstrap (v5.2.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -5007,11 +5020,11 @@
defineJQueryPlugin(Tab);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): toast.js
+ * Bootstrap (v5.2.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* Constants
@@ -5224,10 +5237,10 @@
defineJQueryPlugin(Toast);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): index.umd.js
+ * Bootstrap (v5.2.1): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const index_umd = {
Alert,