aboutsummaryrefslogtreecommitdiff
path: root/js/src/tooltip.js
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/tooltip.js
parentf0e5cc3f417191f5823f426b1ae071c78f427475 (diff)
parentdee3ab427cb9b73639e38a60e1cbb59dc99fedf4 (diff)
downloadbootstrap-74a2d93517553cfd394526d789f6e23e99ace597.tar.xz
bootstrap-74a2d93517553cfd394526d789f6e23e99ace597.zip
Merge branch 'v4-dev' into stretched-link
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r--js/src/tooltip.js22
1 files changed, 17 insertions, 5 deletions
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()]
}