mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 18:44:01 +02:00
Add eslint-plugin-html to lint JS in HTML files (#37186)
This commit is contained in:
19
js/tests/visual/.eslintrc.json
Normal file
19
js/tests/visual/.eslintrc.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"plugins": [
|
||||
"html"
|
||||
],
|
||||
"extends": "../../../.eslintrc.json",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"settings": {
|
||||
"html/html-extensions": [
|
||||
".html"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "off",
|
||||
"no-new": "off",
|
||||
"unicorn/no-array-for-each": "off"
|
||||
}
|
||||
}
|
@@ -201,6 +201,8 @@
|
||||
|
||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||
<script>
|
||||
/* global bootstrap: false */
|
||||
|
||||
const ffBugTestResult = document.getElementById('ff-bug-test-result')
|
||||
const firefoxTestDone = false
|
||||
|
||||
@@ -217,11 +219,7 @@
|
||||
|
||||
const tall = document.getElementById('tall')
|
||||
document.getElementById('tall-toggle').addEventListener('click', () => {
|
||||
if (tall.style.display === 'none') {
|
||||
tall.style.display = 'block'
|
||||
} else {
|
||||
tall.style.display = 'none'
|
||||
}
|
||||
tall.style.display = tall.style.display === 'none' ? 'block' : 'none'
|
||||
})
|
||||
|
||||
const ffBugInput = document.getElementById('ff-bug-input')
|
||||
@@ -231,6 +229,7 @@
|
||||
ffBugInput.addEventListener('focus', reportFirefoxTestResult.bind(true))
|
||||
ffBugInput.removeEventListener('focus', handlerClickFfBugInput)
|
||||
}
|
||||
|
||||
ffBugInput.addEventListener('focus', handlerClickFfBugInput)
|
||||
|
||||
const modalFf = new bootstrap.Modal(firefoxModal)
|
||||
|
@@ -33,6 +33,8 @@
|
||||
|
||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||
<script>
|
||||
/* global bootstrap: false */
|
||||
|
||||
document.querySelectorAll('[data-bs-toggle="popover"]').forEach(popoverEl => new bootstrap.Popover(popoverEl))
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -52,15 +52,17 @@
|
||||
|
||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||
<script>
|
||||
/* global bootstrap: false */
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
document.querySelectorAll('.toast').forEach(toastEl => new bootstrap.Toast(toastEl))
|
||||
|
||||
document.getElementById('btnShowToast').addEventListener('click', () => {
|
||||
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).show())
|
||||
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).show())
|
||||
})
|
||||
|
||||
document.getElementById('btnHideToast').addEventListener('click', () => {
|
||||
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).hide())
|
||||
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).hide())
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
@@ -85,6 +85,8 @@
|
||||
|
||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||
<script>
|
||||
/* global bootstrap: false */
|
||||
|
||||
if (typeof document.body.attachShadow === 'function') {
|
||||
const shadowRoot = document.getElementById('shadow').attachShadow({ mode: 'open' })
|
||||
shadowRoot.innerHTML =
|
||||
@@ -101,32 +103,35 @@
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
new bootstrap.Tooltip('#tooltipElement', {
|
||||
container: '#customContainer'
|
||||
})
|
||||
|
||||
const targetTooltip = new bootstrap.Tooltip('#target', {
|
||||
placement : 'top',
|
||||
trigger : 'manual'
|
||||
placement: 'top',
|
||||
trigger: 'manual'
|
||||
})
|
||||
targetTooltip.show()
|
||||
|
||||
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(tooltipEl=> new bootstrap.Tooltip(tooltipEl))
|
||||
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(tooltipEl => new bootstrap.Tooltip(tooltipEl))
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/* global bootstrap: false */
|
||||
|
||||
new bootstrap.Tooltip('#wrapperTriggeredBySelector', {
|
||||
animation: false,
|
||||
selector: '.bs-dynamic-tooltip'
|
||||
})
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
function duplicateButtons() {
|
||||
const buttonsBlock = document.querySelector('.selectorButtonsBlock')// get first
|
||||
const buttonsBlockClone = buttonsBlock.cloneNode(true)
|
||||
buttonsBlockClone.innerHTML+= new Date().toLocaleString()
|
||||
document.querySelector('#wrapperTriggeredBySelector').append(buttonsBlockClone)
|
||||
buttonsBlockClone.innerHTML += new Date().toLocaleString()
|
||||
document.querySelector('#wrapperTriggeredBySelector').append(buttonsBlockClone)
|
||||
}
|
||||
/* eslint-enable no-unused-vars */
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user