Created by: Intrepidd
It might be really useful to be able to pass a function to the viewport option in some cases, just like that :
$('body').tooltip({
selector: '[data-toggle="tooltip"]',
viewport: function($element) {
var viewport = $element.closest('.tooltip-viewport');
return (viewport.length > 0 ? viewport : $('body'));
}
});
I implemented that in this PR.
I'm open to suggestions, I'm not sure if it's a good idea to accept either a string, an object, or a function. (Did not update the doc yet because of that)
Regarding tests, I noticed that there are no tests asserting that using functions instead of string work (placement for instance), so I copied an existing viewport test, you tell me if that's enough.
Thanks