Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove makeArray #30470

Merged
merged 1 commit into from
Mar 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 9 additions & 13 deletions site/assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@
(function () {
'use strict'

function makeArray(list) {
return [].slice.call(list)
}

// Tooltip and popover demos
makeArray(document.querySelectorAll('.tooltip-demo'))
document.querySelectorAll('.tooltip-demo')
.forEach(function (tooltip) {
new bootstrap.Tooltip(tooltip, {
selector: '[data-toggle="tooltip"]'
})
})

makeArray(document.querySelectorAll('[data-toggle="popover"]'))
document.querySelectorAll('[data-toggle="popover"]')
.forEach(function (popover) {
new bootstrap.Popover(popover)
})

makeArray(document.querySelectorAll('.toast'))
document.querySelectorAll('.toast')
.forEach(function (toastNode) {
var toast = new bootstrap.Toast(toastNode, {
autohide: false
Expand All @@ -42,24 +38,24 @@
})

// Demos within modals
makeArray(document.querySelectorAll('.tooltip-test'))
document.querySelectorAll('.tooltip-test')
.forEach(function (tooltip) {
new bootstrap.Tooltip(tooltip)
})

makeArray(document.querySelectorAll('.popover-test'))
document.querySelectorAll('.popover-test')
.forEach(function (popover) {
new bootstrap.Popover(popover)
})

// Indeterminate checkbox example
makeArray(document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]'))
document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]')
.forEach(function (checkbox) {
checkbox.indeterminate = true
})

// Disable empty links in docs examples
makeArray(document.querySelectorAll('.bd-content [href="#"]'))
document.querySelectorAll('.bd-content [href="#"]')
.forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault()
Expand Down Expand Up @@ -95,12 +91,12 @@

// Insert copy to clipboard button before .highlight
var btnHtml = '<div class="bd-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard">Copy</button></div>'
makeArray(document.querySelectorAll('figure.highlight, div.highlight'))
document.querySelectorAll('figure.highlight, div.highlight')
.forEach(function (element) {
element.insertAdjacentHTML('beforebegin', btnHtml)
})

makeArray(document.querySelectorAll('.btn-clipboard'))
document.querySelectorAll('.btn-clipboard')
.forEach(function (btn) {
var tooltipBtn = new bootstrap.Tooltip(btn)

Expand Down