diff options
| author | Chris Rebert <[email protected]> | 2015-04-21 17:41:06 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2015-04-25 13:16:53 -0700 |
| commit | fc372952e2983934dda338ffefd705112db8008a (patch) | |
| tree | 42025bd7be075b00d02498fbc06d3c1af3a6814b /js/tooltip.js | |
| parent | 8949bcecd2b298d67bce34705a5d235b155a9ba7 (diff) | |
| download | bootstrap-fc372952e2983934dda338ffefd705112db8008a.tar.xz bootstrap-fc372952e2983934dda338ffefd705112db8008a.zip | |
Throw error when tooltip/popover template has multiple top-level elements
Closes #16219.
Diffstat (limited to 'js/tooltip.js')
| -rw-r--r-- | js/tooltip.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/js/tooltip.js b/js/tooltip.js index b2d775938..2d42cab24 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -404,7 +404,13 @@ } Tooltip.prototype.tip = function () { - return (this.$tip = this.$tip || $(this.options.template)) + if (!this.$tip) { + this.$tip = $(this.options.template) + if (this.$tip.length != 1) { + throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') + } + } + return this.$tip } Tooltip.prototype.arrow = function () { |
