aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/collapse.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-06-14 15:39:00 +0200
committerMario Vavti <mario@mariovavti.com>2020-06-14 15:39:00 +0200
commit7270da6a28f836f94f6d98557df9532e587c3646 (patch)
tree86bc0a8d3956ae4bff86dcbb96bb3b88b68e5daa /vendor/twbs/bootstrap/js/dist/collapse.js
parent8cd66145bdd8bf0f43c2a1774181c974335fc494 (diff)
parent92ee27349cb62e0a78f25686c3fe64cd8dd4130c (diff)
downloadvolse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.tar.gz
volse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.tar.bz2
volse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/collapse.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/collapse.js96
1 files changed, 43 insertions, 53 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/collapse.js b/vendor/twbs/bootstrap/js/dist/collapse.js
index 6b128b58f..df44b9551 100644
--- a/vendor/twbs/bootstrap/js/dist/collapse.js
+++ b/vendor/twbs/bootstrap/js/dist/collapse.js
@@ -1,6 +1,6 @@
/*!
- * Bootstrap collapse.js v4.4.1 (https://getbootstrap.com/)
- * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Bootstrap collapse.js v4.5.0 (https://getbootstrap.com/)
+ * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
(function (global, factory) {
@@ -9,8 +9,8 @@
(global = global || self, global.Collapse = factory(global.jQuery, global.Util));
}(this, (function ($, Util) { 'use strict';
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
- Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
+ $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
+ Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util;
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
@@ -84,7 +84,7 @@
*/
var NAME = 'collapse';
- var VERSION = '4.4.1';
+ var VERSION = '4.5.0';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@@ -97,42 +97,32 @@
toggle: 'boolean',
parent: '(string|element)'
};
- var Event = {
- SHOW: "show" + EVENT_KEY,
- SHOWN: "shown" + EVENT_KEY,
- HIDE: "hide" + EVENT_KEY,
- HIDDEN: "hidden" + EVENT_KEY,
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
- };
- var ClassName = {
- SHOW: 'show',
- COLLAPSE: 'collapse',
- COLLAPSING: 'collapsing',
- COLLAPSED: 'collapsed'
- };
- var Dimension = {
- WIDTH: 'width',
- HEIGHT: 'height'
- };
- var Selector = {
- ACTIVES: '.show, .collapsing',
- DATA_TOGGLE: '[data-toggle="collapse"]'
- };
+ var EVENT_SHOW = "show" + EVENT_KEY;
+ var EVENT_SHOWN = "shown" + EVENT_KEY;
+ var EVENT_HIDE = "hide" + EVENT_KEY;
+ var EVENT_HIDDEN = "hidden" + EVENT_KEY;
+ var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
+ var CLASS_NAME_SHOW = 'show';
+ var CLASS_NAME_COLLAPSE = 'collapse';
+ var CLASS_NAME_COLLAPSING = 'collapsing';
+ var CLASS_NAME_COLLAPSED = 'collapsed';
+ var DIMENSION_WIDTH = 'width';
+ var DIMENSION_HEIGHT = 'height';
+ var SELECTOR_ACTIVES = '.show, .collapsing';
+ var SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
- var Collapse =
- /*#__PURE__*/
- function () {
+ var Collapse = /*#__PURE__*/function () {
function Collapse(element, config) {
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
- var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
+ var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = toggleList[i];
@@ -164,7 +154,7 @@
// Public
_proto.toggle = function toggle() {
- if ($(this._element).hasClass(ClassName.SHOW)) {
+ if ($(this._element).hasClass(CLASS_NAME_SHOW)) {
this.hide();
} else {
this.show();
@@ -174,7 +164,7 @@
_proto.show = function show() {
var _this = this;
- if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
+ if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW)) {
return;
}
@@ -182,12 +172,12 @@
var activesData;
if (this._parent) {
- actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
+ actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
if (typeof _this._config.parent === 'string') {
return elem.getAttribute('data-parent') === _this._config.parent;
}
- return elem.classList.contains(ClassName.COLLAPSE);
+ return elem.classList.contains(CLASS_NAME_COLLAPSE);
});
if (actives.length === 0) {
@@ -203,7 +193,7 @@
}
}
- var startEvent = $.Event(Event.SHOW);
+ var startEvent = $.Event(EVENT_SHOW);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
@@ -220,22 +210,22 @@
var dimension = this._getDimension();
- $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
+ $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
this._element.style[dimension] = 0;
if (this._triggerArray.length) {
- $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
+ $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
}
this.setTransitioning(true);
var complete = function complete() {
- $(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
+ $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
_this._element.style[dimension] = '';
_this.setTransitioning(false);
- $(_this._element).trigger(Event.SHOWN);
+ $(_this._element).trigger(EVENT_SHOWN);
};
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
@@ -248,11 +238,11 @@
_proto.hide = function hide() {
var _this2 = this;
- if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
+ if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW)) {
return;
}
- var startEvent = $.Event(Event.HIDE);
+ var startEvent = $.Event(EVENT_HIDE);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
@@ -263,7 +253,7 @@
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
Util.reflow(this._element);
- $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
+ $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
var triggerArrayLength = this._triggerArray.length;
if (triggerArrayLength > 0) {
@@ -274,8 +264,8 @@
if (selector !== null) {
var $elem = $([].slice.call(document.querySelectorAll(selector)));
- if (!$elem.hasClass(ClassName.SHOW)) {
- $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
+ if (!$elem.hasClass(CLASS_NAME_SHOW)) {
+ $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
}
}
}
@@ -286,7 +276,7 @@
var complete = function complete() {
_this2.setTransitioning(false);
- $(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
+ $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
};
this._element.style[dimension] = '';
@@ -309,7 +299,7 @@
;
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default, {}, config);
+ config = _objectSpread2(_objectSpread2({}, Default), config);
config.toggle = Boolean(config.toggle); // Coerce string values
Util.typeCheckConfig(NAME, config, DefaultType);
@@ -317,8 +307,8 @@
};
_proto._getDimension = function _getDimension() {
- var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
- return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
+ var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
+ return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
};
_proto._getParent = function _getParent() {
@@ -345,10 +335,10 @@
};
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
- var isOpen = $(element).hasClass(ClassName.SHOW);
+ var isOpen = $(element).hasClass(CLASS_NAME_SHOW);
if (triggerArray.length) {
- $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
+ $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
} // Static
;
@@ -363,9 +353,9 @@
var $this = $(this);
var data = $this.data(DATA_KEY);
- var _config = _objectSpread2({}, Default, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
+ var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default), $this.data()), typeof config === 'object' && config ? config : {});
- if (!data && _config.toggle && /show|hide/.test(config)) {
+ if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
_config.toggle = false;
}
@@ -405,7 +395,7 @@
*/
- $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
+ $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.currentTarget.tagName === 'A') {
event.preventDefault();