diff options
author | Mario <mario@mariovavti.com> | 2021-01-13 09:50:53 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-01-13 09:50:53 +0000 |
commit | 5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a (patch) | |
tree | 7521f4800e393538d19c393c6f495ea2d41cbf5a /vendor/twbs/bootstrap/js/dist/button.js | |
parent | 0bc4c7d1a0e4348018e533be600ad1c648fd97fb (diff) | |
parent | 4d2bcbc5837a7d99dc541595ca8087c335242af0 (diff) | |
download | volse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.tar.gz volse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.tar.bz2 volse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.zip |
Merge branch '5.2RC'5.2
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/button.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/button.js | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/button.js b/vendor/twbs/bootstrap/js/dist/button.js index 93b0634cf..722c7c41b 100644 --- a/vendor/twbs/bootstrap/js/dist/button.js +++ b/vendor/twbs/bootstrap/js/dist/button.js @@ -1,5 +1,5 @@ /*! - * Bootstrap button.js v4.5.2 (https://getbootstrap.com/) + * Bootstrap button.js v4.5.3 (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/main/LICENSE) */ @@ -9,7 +9,9 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.jQuery)); }(this, (function ($) { 'use strict'; - $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var $__default = /*#__PURE__*/_interopDefaultLegacy($); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -21,11 +23,11 @@ */ var NAME = 'button'; - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; var DATA_KEY = 'bs.button'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; + var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME]; var CLASS_NAME_ACTIVE = 'active'; var CLASS_NAME_BUTTON = 'btn'; var CLASS_NAME_FOCUS = 'focus'; @@ -48,6 +50,7 @@ var Button = /*#__PURE__*/function () { function Button(element) { this._element = element; + this.shouldAvoidTriggerChange = false; } // Getters @@ -57,7 +60,7 @@ _proto.toggle = function toggle() { var triggerChangeEvent = true; var addAriaPressed = true; - var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0]; + var rootElement = $__default['default'](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; if (rootElement) { var input = this._element.querySelector(SELECTOR_INPUT); @@ -70,7 +73,7 @@ var activeElement = rootElement.querySelector(SELECTOR_ACTIVE); if (activeElement) { - $(activeElement).removeClass(CLASS_NAME_ACTIVE); + $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE); } } } @@ -81,7 +84,9 @@ input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE); } - $(input).trigger('change'); + if (!this.shouldAvoidTriggerChange) { + $__default['default'](input).trigger('change'); + } } input.focus(); @@ -95,26 +100,29 @@ } if (triggerChangeEvent) { - $(this._element).toggleClass(CLASS_NAME_ACTIVE); + $__default['default'](this._element).toggleClass(CLASS_NAME_ACTIVE); } } }; _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); + $__default['default'].removeData(this._element, DATA_KEY); this._element = null; } // Static ; - Button._jQueryInterface = function _jQueryInterface(config) { + Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) { return this.each(function () { - var data = $(this).data(DATA_KEY); + var $element = $__default['default'](this); + var data = $element.data(DATA_KEY); if (!data) { data = new Button(this); - $(this).data(DATA_KEY, data); + $element.data(DATA_KEY, data); } + data.shouldAvoidTriggerChange = avoidTriggerChange; + if (config === 'toggle') { data[config](); } @@ -137,12 +145,12 @@ */ - $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { + $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { var button = event.target; var initialButton = button; - if (!$(button).hasClass(CLASS_NAME_BUTTON)) { - button = $(button).closest(SELECTOR_BUTTON)[0]; + if (!$__default['default'](button).hasClass(CLASS_NAME_BUTTON)) { + button = $__default['default'](button).closest(SELECTOR_BUTTON)[0]; } if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { @@ -156,15 +164,15 @@ return; } - if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') { - Button._jQueryInterface.call($(button), 'toggle'); + if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { + Button._jQueryInterface.call($__default['default'](button), 'toggle', initialButton.tagName === 'INPUT'); } } }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { - var button = $(event.target).closest(SELECTOR_BUTTON)[0]; - $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); + var button = $__default['default'](event.target).closest(SELECTOR_BUTTON)[0]; + $__default['default'](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); }); - $(window).on(EVENT_LOAD_DATA_API, function () { + $__default['default'](window).on(EVENT_LOAD_DATA_API, function () { // ensure correct active class is set to match the controls' actual values/states // find all checkboxes/readio buttons inside data-toggle groups var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); @@ -199,11 +207,11 @@ * ------------------------------------------------------------------------ */ - $.fn[NAME] = Button._jQueryInterface; - $.fn[NAME].Constructor = Button; + $__default['default'].fn[NAME] = Button._jQueryInterface; + $__default['default'].fn[NAME].Constructor = Button; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; + $__default['default'].fn[NAME].noConflict = function () { + $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; return Button._jQueryInterface; }; |