aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2018-12-22 18:32:28 +0200
committerGitHub <[email protected]>2018-12-22 18:32:28 +0200
commit74a2d93517553cfd394526d789f6e23e99ace597 (patch)
treed012dc1591ad0903695c88da9a9e5d8eb4993b52 /js/src
parentf0e5cc3f417191f5823f426b1ae071c78f427475 (diff)
parentdee3ab427cb9b73639e38a60e1cbb59dc99fedf4 (diff)
downloadbootstrap-74a2d93517553cfd394526d789f6e23e99ace597.tar.xz
bootstrap-74a2d93517553cfd394526d789f6e23e99ace597.zip
Merge branch 'v4-dev' into stretched-link
Diffstat (limited to 'js/src')
-rw-r--r--js/src/alert.js4
-rw-r--r--js/src/button.js6
-rw-r--r--js/src/carousel.js4
-rw-r--r--js/src/collapse.js4
-rw-r--r--js/src/dropdown.js7
-rw-r--r--js/src/index.js2
-rw-r--r--js/src/modal.js6
-rw-r--r--js/src/popover.js4
-rw-r--r--js/src/scrollspy.js4
-rw-r--r--js/src/tab.js4
-rw-r--r--js/src/toast.js19
-rw-r--r--js/src/tooltip.js22
-rw-r--r--js/src/util.js25
13 files changed, 76 insertions, 35 deletions
diff --git a/js/src/alert.js b/js/src/alert.js
index 7edc96a3a..3ce95bced 100644
--- a/js/src/alert.js
+++ b/js/src/alert.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): alert.js
+ * Bootstrap (v4.2.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'alert'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/js/src/button.js b/js/src/button.js
index 75b21d94d..ba6b8b5ec 100644
--- a/js/src/button.js
+++ b/js/src/button.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): button.js
+ * Bootstrap (v4.2.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@ import $ from 'jquery'
*/
const NAME = 'button'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.button'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -29,7 +29,7 @@ const ClassName = {
const Selector = {
DATA_TOGGLE_CARROT : '[data-toggle^="button"]',
DATA_TOGGLE : '[data-toggle="buttons"]',
- INPUT : 'input',
+ INPUT : 'input:not([type="hidden"])',
ACTIVE : '.active',
BUTTON : '.btn'
}
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 734e15596..21ec57a2e 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): carousel.js
+ * Bootstrap (v4.2.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'carousel'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/js/src/collapse.js b/js/src/collapse.js
index bf154ab25..ccbfbef7b 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): collapse.js
+ * Bootstrap (v4.2.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'collapse'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.collapse'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index d8fe5fdba..9aaf5a339 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): dropdown.js
+ * Bootstrap (v4.2.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@ import Util from './util'
*/
const NAME = 'dropdown'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.dropdown'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -468,8 +468,7 @@ class Dropdown {
const parent = Dropdown._getParentFromElement(this)
const isActive = $(parent).hasClass(ClassName.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) {
const toggle = parent.querySelector(Selector.DATA_TOGGLE)
$(toggle).trigger('focus')
diff --git a/js/src/index.js b/js/src/index.js
index 6d99ff391..7de37e72b 100644
--- a/js/src/index.js
+++ b/js/src/index.js
@@ -14,7 +14,7 @@ import Util from './util'
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): index.js
+ * Bootstrap (v4.2.1): index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/js/src/modal.js b/js/src/modal.js
index 5dfb64407..125182e13 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): modal.js
+ * Bootstrap (v4.2.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'modal'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.modal'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -243,6 +243,7 @@ class Modal {
this._element.style.display = 'block'
this._element.removeAttribute('aria-hidden')
+ this._element.setAttribute('aria-modal', true)
this._element.scrollTop = 0
if (transition) {
@@ -314,6 +315,7 @@ class Modal {
_hideModal() {
this._element.style.display = 'none'
this._element.setAttribute('aria-hidden', true)
+ this._element.removeAttribute('aria-modal')
this._isTransitioning = false
this._showBackdrop(() => {
$(document.body).removeClass(ClassName.OPEN)
diff --git a/js/src/popover.js b/js/src/popover.js
index 862ec096a..96f844d79 100644
--- a/js/src/popover.js
+++ b/js/src/popover.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): popover.js
+ * Bootstrap (v4.2.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Tooltip from './tooltip'
*/
const NAME = 'popover'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js
index c323c2aea..98b681750 100644
--- a/js/src/scrollspy.js
+++ b/js/src/scrollspy.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): scrollspy.js
+ * Bootstrap (v4.2.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'scrollspy'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.scrollspy'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/js/src/tab.js b/js/src/tab.js
index b7b0dd12a..64b66d861 100644
--- a/js/src/tab.js
+++ b/js/src/tab.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): tab.js
+ * Bootstrap (v4.2.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'tab'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.tab'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/js/src/toast.js b/js/src/toast.js
index 23d482d35..98be2a418 100644
--- a/js/src/toast.js
+++ b/js/src/toast.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): toast.js
+ * Bootstrap (v4.2.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'toast'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.toast'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
@@ -29,9 +29,10 @@ const Event = {
}
const ClassName = {
- FADE : 'fade',
- HIDE : 'hide',
- SHOW : 'show'
+ FADE : 'fade',
+ HIDE : 'hide',
+ SHOW : 'show',
+ SHOWING : 'showing'
}
const DefaultType = {
@@ -84,6 +85,9 @@ class Toast {
}
const complete = () => {
+ this._element.classList.remove(ClassName.SHOWING)
+ this._element.classList.add(ClassName.SHOW)
+
$(this._element).trigger(Event.SHOWN)
if (this._config.autohide) {
@@ -91,7 +95,8 @@ class Toast {
}
}
- this._element.classList.add(ClassName.SHOW)
+ this._element.classList.remove(ClassName.HIDE)
+ this._element.classList.add(ClassName.SHOWING)
if (this._config.animation) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
@@ -162,11 +167,11 @@ class Toast {
_close() {
const complete = () => {
+ this._element.classList.add(ClassName.HIDE)
$(this._element).trigger(Event.HIDDEN)
}
this._element.classList.remove(ClassName.SHOW)
-
if (this._config.animation) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index f428a79eb..366781b3e 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): tooltip.js
+ * Bootstrap (v4.2.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@ import Util from './util'
*/
const NAME = 'tooltip'
-const VERSION = '4.1.3'
+const VERSION = '4.2.1'
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
@@ -244,8 +244,9 @@ class Tooltip {
if (this.isWithContent() && this._isEnabled) {
$(this.element).trigger(showEvent)
+ const shadowRoot = Util.findShadowRoot(this.element)
const isInTheDom = $.contains(
- this.element.ownerDocument.documentElement,
+ shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement,
this.element
)
@@ -272,8 +273,7 @@ class Tooltip {
const attachment = this._getAttachment(placement)
this.addAttachmentClass(attachment)
- const container = this.config.container === false ? document.body : $(document).find(this.config.container)
-
+ const container = this._getContainer()
$(tip).data(this.constructor.DATA_KEY, this)
if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
@@ -450,6 +450,18 @@ class Tooltip {
// Private
+ _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)
+ }
+
_getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()]
}
diff --git a/js/src/util.js b/js/src/util.js
index e9665d24f..0d434c4c5 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): util.js
+ * Bootstrap (v4.2.1): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -142,6 +142,29 @@ const Util = {
}
}
}
+ },
+
+ findShadowRoot(element) {
+ if (!document.documentElement.attachShadow) {
+ return null
+ }
+
+ // Can find the shadow root otherwise it'll return the document
+ if (typeof element.getRootNode === 'function') {
+ const 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)
}
}