diff options
author | Mark Otto <markdotto@gmail.com> | 2018-12-16 02:13:22 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-12-16 02:33:05 +0300 |
commit | ee72e7838df71e28825480e44b278453e092a64c (patch) | |
tree | 9fb6ff638b1c86df8ef7125c0cb76215fdf9736e /dist/js/bootstrap.js | |
parent | ffd3402a923b19754b4735803f9f9580bc1c38a5 (diff) |
dist
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r-- | dist/js/bootstrap.js | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 705ac2bb96..a5a91a1384 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -193,6 +193,28 @@ } } } + }, + findShadowRoot: function findShadowRoot(element) { + if (!document.documentElement.attachShadow) { + return null; + } // Can find the shadow root otherwise it'll return the document + + + if (typeof element.getRootNode === 'function') { + var root = element.getRootNode(); + return root instanceof ShadowRoot ? root : null; + } + + if (element instanceof ShadowRoot) { + return element; + } // when we don't find a shadow root + + + if (!element.parentNode) { + return null; + } + + return Util.findShadowRoot(element.parentNode); } }; setTransitionEndSupport(); @@ -382,7 +404,7 @@ var Selector$1 = { DATA_TOGGLE_CARROT: '[data-toggle^="button"]', DATA_TOGGLE: '[data-toggle="buttons"]', - INPUT: 'input', + INPUT: 'input:not([type="hidden"])', ACTIVE: '.active', BUTTON: '.btn' }; @@ -1913,7 +1935,7 @@ var isActive = $(parent).hasClass(ClassName$4.SHOW); - if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { + if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { if (event.which === ESCAPE_KEYCODE) { var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); $(toggle).trigger('focus'); @@ -2219,6 +2241,8 @@ this._element.removeAttribute('aria-hidden'); + this._element.setAttribute('aria-modal', true); + this._element.scrollTop = 0; if (transition) { @@ -2298,6 +2322,8 @@ this._element.setAttribute('aria-hidden', true); + this._element.removeAttribute('aria-modal'); + this._isTransitioning = false; this._showBackdrop(function () { @@ -2764,7 +2790,8 @@ if (this.isWithContent() && this._isEnabled) { $(this.element).trigger(showEvent); - var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element); + var shadowRoot = Util.findShadowRoot(this.element); + var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); if (showEvent.isDefaultPrevented() || !isInTheDom) { return; @@ -2785,7 +2812,9 @@ var attachment = this._getAttachment(placement); this.addAttachmentClass(attachment); - var container = this.config.container === false ? document.body : $(document).find(this.config.container); + + var container = this._getContainer(); + $(tip).data(this.constructor.DATA_KEY, this); if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { @@ -2957,6 +2986,18 @@ }; // Private + _proto._getContainer = function _getContainer() { + if (this.config.container === false) { + return document.body; + } + + if (Util.isElement(this.config.container)) { + return $(this.config.container); + } + + return $(document).find(this.config.container); + }; + _proto._getAttachment = function _getAttachment(placement) { return AttachmentMap$1[placement.toUpperCase()]; }; @@ -3976,7 +4017,8 @@ var ClassName$a = { FADE: 'fade', HIDE: 'hide', - SHOW: 'show' + SHOW: 'show', + SHOWING: 'showing' }; var DefaultType$7 = { animation: 'boolean', @@ -4023,6 +4065,10 @@ } var complete = function complete() { + _this._element.classList.remove(ClassName$a.SHOWING); + + _this._element.classList.add(ClassName$a.SHOW); + $(_this._element).trigger(Event$a.SHOWN); if (_this._config.autohide) { @@ -4030,7 +4076,9 @@ } }; - this._element.classList.add(ClassName$a.SHOW); + this._element.classList.remove(ClassName$a.HIDE); + + this._element.classList.add(ClassName$a.SHOWING); if (this._config.animation) { var transitionDuration = Util.getTransitionDurationFromElement(this._element); @@ -4091,6 +4139,8 @@ var _this4 = this; var complete = function complete() { + _this4._element.classList.add(ClassName$a.HIDE); + $(_this4._element).trigger(Event$a.HIDDEN); }; |