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 /js/dist/tooltip.js | |
parent | ffd3402a923b19754b4735803f9f9580bc1c38a5 (diff) |
dist
Diffstat (limited to 'js/dist/tooltip.js')
-rw-r--r-- | js/dist/tooltip.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/js/dist/tooltip.js b/js/dist/tooltip.js index c4e05db201..3b5c275286 100644 --- a/js/dist/tooltip.js +++ b/js/dist/tooltip.js @@ -259,7 +259,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; @@ -280,7 +281,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)) { @@ -452,6 +455,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[placement.toUpperCase()]; }; |