diff options
| author | Johann-S <[email protected]> | 2018-12-05 10:25:00 +0100 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2018-12-05 10:57:02 +0100 |
| commit | 37f74c70702c4e90e12f062e63358cb64670eb01 (patch) | |
| tree | b51bfab62ae869cef3502b79319888866bdcd2ba /js/src/tooltip.js | |
| parent | 1a171b80ab1b46f59cfd727a7e5f8a10fc43b189 (diff) | |
| download | bootstrap-37f74c70702c4e90e12f062e63358cb64670eb01.tar.xz bootstrap-37f74c70702c4e90e12f062e63358cb64670eb01.zip | |
fix regression about using element for tooltip container option
Diffstat (limited to 'js/src/tooltip.js')
| -rw-r--r-- | js/src/tooltip.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index f428a79eb..1c40dfed3 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -272,8 +272,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 +449,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()] } |
