mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 00:54:04 +02:00
50
js/dist/offcanvas.js
vendored
50
js/dist/offcanvas.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap offcanvas.js v5.0.0 (https://getbootstrap.com/)
|
||||
* Bootstrap offcanvas.js v5.0.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
@@ -17,12 +17,6 @@
|
||||
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
@@ -90,7 +84,17 @@
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
const isElement = obj => (obj[0] || obj).nodeType;
|
||||
const isElement = obj => {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof obj.jquery !== 'undefined') {
|
||||
obj = obj[0];
|
||||
}
|
||||
|
||||
return typeof obj.nodeType !== 'undefined';
|
||||
};
|
||||
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
@@ -174,12 +178,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
const defineJQueryPlugin = plugin => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
const name = plugin.NAME;
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
@@ -200,7 +205,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/scrollBar.js
|
||||
* Bootstrap (v5.0.1): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -274,7 +279,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/backdrop.js
|
||||
* Bootstrap (v5.0.1): util/backdrop.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -358,6 +363,7 @@
|
||||
config = { ...Default$1,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
};
|
||||
config.rootElement = config.rootElement || document.body;
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
return config;
|
||||
}
|
||||
@@ -402,7 +408,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): offcanvas.js
|
||||
* Bootstrap (v5.0.1): offcanvas.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -457,12 +463,12 @@
|
||||
} // Getters
|
||||
|
||||
|
||||
static get Default() {
|
||||
return Default;
|
||||
static get NAME() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
static get Default() {
|
||||
return Default;
|
||||
} // Public
|
||||
|
||||
|
||||
@@ -508,9 +514,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', completeCallBack);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
this._queueCallback(completeCallBack, this._element, true);
|
||||
}
|
||||
|
||||
hide() {
|
||||
@@ -550,9 +554,7 @@
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
||||
};
|
||||
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', completeCallback);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
this._queueCallback(completeCallback, this._element, true);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
@@ -560,8 +562,6 @@
|
||||
|
||||
super.dispose();
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
this._config = null;
|
||||
this._backdrop = null;
|
||||
} // Private
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
defineJQueryPlugin(NAME, Offcanvas);
|
||||
defineJQueryPlugin(Offcanvas);
|
||||
|
||||
return Offcanvas;
|
||||
|
||||
|
Reference in New Issue
Block a user