From fc372952e2983934dda338ffefd705112db8008a Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 21 Apr 2015 17:41:06 -0700 Subject: Throw error when tooltip/popover template has multiple top-level elements Closes #16219. --- js/tooltip.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'js/tooltip.js') 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 () { -- cgit v1.2.3