aboutsummaryrefslogtreecommitdiff
path: root/js/tooltip.js
diff options
context:
space:
mode:
authorAdrien Siami <[email protected]>2015-03-25 14:46:21 +0100
committerChris Rebert <[email protected]>2015-04-21 22:20:15 -0700
commite949505b89ca146e3af0cf735e100c82703f1cda (patch)
treeedc2027677d0377a98d3fa0a3f2a263b93491815 /js/tooltip.js
parent48232aad6cdb5280e55e0aa0c42a4bb0d06ac03b (diff)
downloadbootstrap-e949505b89ca146e3af0cf735e100c82703f1cda.tar.xz
bootstrap-e949505b89ca146e3af0cf735e100c82703f1cda.zip
Allow viewport option to be a function
Closes #16151 by merging a rebased version of it that adds docs and 1 more assertion.
Diffstat (limited to 'js/tooltip.js')
-rw-r--r--js/tooltip.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index bbff2cdec..b2d775938 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -50,7 +50,7 @@
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
- this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
+ this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')