aboutsummaryrefslogtreecommitdiff
path: root/js/tooltip.js
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2015-01-05 14:22:49 -0800
committerChris Rebert <[email protected]>2015-01-05 14:22:49 -0800
commitf6a837cbf1eb24429a4356ef95d7a52e6da35b43 (patch)
treee9c0e0f3723b6c8d32a9bac8ed24111f21d667cd /js/tooltip.js
parent08410280091ff1ef77e110c1e5e29eb8f3653a84 (diff)
downloadbootstrap-f6a837cbf1eb24429a4356ef95d7a52e6da35b43.tar.xz
bootstrap-f6a837cbf1eb24429a4356ef95d7a52e6da35b43.zip
Make $(document).tooltip({...}) without a `selector` throw an error
Closes #15484
Diffstat (limited to 'js/tooltip.js')
-rw-r--r--js/tooltip.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index a1140d247..b47c010f3 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -52,6 +52,10 @@
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
+ if (this.$element[0] instanceof window.Document && !this.options.selector) {
+ throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!');
+ }
+
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {