In the Bootstrap Tooltip documentation it gives this sample code to initialize all tooltips in page:
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
What is the reason to use [].slice.call()
?
Cannot document.querySelectorAll()
be called directly?
2